<template>
  <div class="container-content">
    <el-form
      ref="formRef"
      :model="formData"
      :rules="rules"
      size="medium"
      label-width="90px"
      label-position="left"
    >
      <el-collapse v-model="activeName" @change="handleChange">
        <el-collapse-item title="基本" name="basic">
          <el-row :gutter="15">
            <el-col :span="24">
              <el-form-item
                label="立账类型"
                prop="kingInvoicePayableEntity.accountType"
              >
                <el-select
                  v-model="formData.kingInvoicePayableEntity.accountType"
                  placeholder="请选择立账类型"
                  clearable
                  :style="{ width: '100%' }"
                >
                  <el-option
                    v-for="(item, index) in accountTypeOptions"
                    :key="index"
                    :label="item.label"
                    :value="item.value"
                    :disabled="item.disabled"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col v-if="rowId" :span="8">
              <el-form-item
                label="单据类型"
                prop="kingInvoicePayableEntity.docTypeId"
              >
                <el-input
                  :disabled="true"
                  style="width: 100%"
                  v-model="formData.kingInvoicePayableEntity.docTypeId"
                  :props="props"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col v-if="!rowId" :span="8">
              <el-form-item
                label="单据类型"
                prop="kingInvoicePayableEntity.docTypeId"
              >
                <el-cascader
                  style="width: 100%"
                  v-model="formData.kingInvoicePayableEntity.docTypeId"
                  :props="props"
                  @change="handleInvoiceChange"
                ></el-cascader>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="供应商"
                prop="kingInvoicePayableEntity.supplierName"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.supplierName"
                  placeholder="请选择供应商"
                  clearable
                  :style="{ width: '100%' }"
                  readonly
                >
                  <i
                    slot="suffix"
                    class="el-input__icon el-icon-notebook-2"
                    style="cursor: pointer"
                    @click="showDialog('supplier')"
                  ></i>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="采购员"
                prop="kingInvoicePayableEntity.procureUser"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.procureUser"
                  placeholder="请选择采购员"
                  clearable
                  readonly
                  :style="{ width: '100%' }"
                >
                  <i
                    slot="suffix"
                    class="el-input__icon el-icon-notebook-2"
                    style="cursor: pointer"
                    @click="showDialog('user')"
                  ></i>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="单据编号"
                prop="kingInvoicePayableEntity.docNo"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.docNo"
                  placeholder="请输入单据编号"
                  clearable
                  :style="{ width: '100%' }"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="币别"
                prop="kingInvoicePayableEntity.currencyName"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.currencyName"
                  placeholder="请选择币别"
                  clearable
                  readonly
                  :style="{ width: '100%' }"
                >
                  <i
                    slot="suffix"
                    class="el-input__icon el-icon-notebook-2"
                    style="cursor: pointer"
                    @click="showDialog('currency')"
                  ></i>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="结算组织"
                prop="kingInvoicePayableEntity.settlementDeptId"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.settlementDeptId"
                  placeholder="请输入结算组织"
                  clearable
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="业务时间"
                prop="kingInvoicePayableEntity.bizTime"
              >
                <el-date-picker
                  v-model="formData.kingInvoicePayableEntity.bizTime"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                  :style="{ width: '100%' }"
                  placeholder="请选择业务时间"
                  clearable
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="价税合计"
                prop="kingInvoicePayableEntity.totalTaxAmount"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.totalTaxAmount"
                  placeholder="请输入价税合计"
                  clearable
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="付款组织"
                prop="kingInvoicePayableEntity.payDeptId"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.payDeptId"
                  placeholder="请输入付款组织"
                  clearable
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="到期日"
                prop="kingInvoicePayableEntity.dueTime"
              >
                <el-date-picker
                  v-model="formData.kingInvoicePayableEntity.dueTime"
                  format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd"
                  :style="{ width: '100%' }"
                  placeholder="请选择到期日"
                  clearable
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="付款条件"
                prop="kingInvoicePayableEntity.payTermsId"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.payTermsId"
                  placeholder="请输入付款条件"
                  clearable
                  readonly
                  :style="{ width: '100%' }"
                >
                  <i
                    slot="suffix"
                    class="el-input__icon el-icon-notebook-2"
                    style="cursor: pointer"
                    @click="showDialog('payTerms')"
                  ></i>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="采购组织"
                prop="kingInvoicePayableEntity.procureCompany"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.procureCompany"
                  placeholder="请输入采购组织"
                  clearable
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="单据状态"
                prop="kingInvoicePayableEntity.status"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.status"
                  placeholder="请输入单据状态"
                  clearable
                  :style="{ width: '100%' }"
                >
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="采购部门"
                prop="kingInvoicePayableEntity.procureDeptName"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.procureDeptName"
                  placeholder="请输入采购部门"
                  clearable
                  readonly
                  :style="{ width: '100%' }"
                >
                  <i
                    slot="suffix"
                    class="el-input__icon el-icon-notebook-2"
                    style="cursor: pointer"
                    @click="showDialog('dept')"
                  ></i>
                </el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label="整单折扣金额"
                prop="kingInvoicePayableEntity.discountAmount"
                label-width="100px"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.discountAmount"
                  placeholder="请输入整单折扣金额"
                  clearable
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="15">
            <el-col :span="8">
              <el-form-item
                label="价外税"
                prop="kingInvoicePayableEntity.isExtraPriceTax"
              >
                <el-radio-group
                  v-model="formData.kingInvoicePayableEntity.isExtraPriceTax"
                  size="medium"
                >
                  <el-radio
                    v-for="(item, index) in isExtraPriceTaxOptions"
                    :key="index"
                    :label="item.value"
                    :disabled="item.disabled"
                    border
                    >{{ item.label }}</el-radio
                  >
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label-width="140px"
                label="按费用项目生成计划"
                prop="kingInvoicePayableEntity.isFee"
              >
                <el-radio-group
                  v-model="formData.kingInvoicePayableEntity.isFee"
                  size="medium"
                >
                  <el-radio
                    v-for="(item, index) in isFeeOptions"
                    :key="index"
                    :label="item.value"
                    :disabled="item.disabled"
                    border
                    >{{ item.label }}</el-radio
                  >
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label-width="120px"
                label="按含税单价录入"
                prop="kingInvoicePayableEntity.isIncludeTaxPrice"
              >
                <el-radio-group
                  v-model="formData.kingInvoicePayableEntity.isIncludeTaxPrice"
                  size="medium"
                >
                  <el-radio
                    v-for="(item, index) in isIncludeTaxPriceOptions"
                    :key="index"
                    :label="item.value"
                    :disabled="item.disabled"
                    border
                    >{{ item.label }}</el-radio
                  >
                </el-radio-group>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="15">
            <el-col :span="8">
              <el-form-item
                label-width="100px"
                label="税额计入成本"
                prop="kingInvoicePayableEntity.isTaxCostAmount"
              >
                <el-radio-group
                  v-model="formData.kingInvoicePayableEntity.isTaxCostAmount"
                  size="medium"
                >
                  <el-radio
                    v-for="(item, index) in isTaxCostAmountOptions"
                    :key="index"
                    :label="item.value"
                    :disabled="item.disabled"
                    border
                    >{{ item.label }}</el-radio
                  >
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item
                label-width="100px"
                label="先到票后入库"
                prop="kingInvoicePayableEntity.isTicketsBefore"
              >
                <el-radio-group
                  v-model="formData.kingInvoicePayableEntity.isTicketsBefore"
                  size="medium"
                >
                  <el-radio
                    v-for="(item, index) in isTicketsBeforeOptions"
                    :key="index"
                    :label="item.value"
                    :disabled="item.disabled"
                    border
                    >{{ item.label }}</el-radio
                  >
                </el-radio-group>
              </el-form-item>
            </el-col>
            <el-col :span="24">
              <el-form-item
                label="备注"
                prop="kingInvoicePayableEntity.remarks"
              >
                <el-input
                  v-model="formData.kingInvoicePayableEntity.remarks"
                  type="textarea"
                  placeholder="请输入备注"
                  :autosize="{ minRows: 4, maxRows: 4 }"
                  :style="{ width: '100%' }"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-collapse-item>
        <el-collapse-item title="明细" name="detail">
          <el-table
            :data="formData.kingInvoicePayableDetailEntities"
            style="width: 100%"
            highlight-current-row
            border
          >
            <template #empty>
              <el-button plain type="primary" round @click="addNewRow('detail')"
                >添加新行
              </el-button>
            </template>
            <el-table-column label="操作" width="120" fixed>
              <template slot-scope="scope">
                <el-button
                  plain
                  icon="el-icon-plus"
                  size="mini"
                  @click="handleDataAdd(scope.$index, scope.row, 'detail')"
                ></el-button>
                <el-button
                  plain
                  icon="el-icon-minus"
                  size="mini"
                  @click="handleDataDelete(scope.$index, scope.row, 'detail')"
                ></el-button>
              </template>
            </el-table-column>
            <el-table-column
              label="序号"
              type="index"
              align="center"
            ></el-table-column>
            <el-table-column label="物料编码" v-if="docTypeStandard.length">
              <template slot-scope="scope">
                <el-form-item
                  prop="materialCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.materialCode" clearable readonly>
                    <i
                      slot="suffix"
                      class="el-input__icon el-icon-notebook-2"
                      style="cursor: pointer"
                      @click="showDialog('materialCode', scope.$index)"
                    ></i>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="费用项目编码" v-if="docTypeExpanse.length">
              <template slot-scope="scope">
                <el-form-item
                  prop="feeCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.feeCode" clearable readonly>
                    <i
                      slot="suffix"
                      class="el-input__icon el-icon-notebook-2"
                      style="cursor: pointer"
                      @click="showDialog('fee', scope.$index)"
                    ></i>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="费用项目名称" v-if="docTypeExpanse.length">
              <template slot-scope="scope">
                <el-form-item prop="feeId" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.feeId" clearable disabled>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="费用承担部门" v-if="docTypeExpanse.length">
              <template slot-scope="scope">
                <el-form-item
                  prop="feeBearDeptId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input
                    v-model="scope.row.feeBearDeptId"
                    clearable
                    readonly
                  >
                    <i
                      slot="suffix"
                      class="el-input__icon el-icon-notebook-2"
                      style="cursor: pointer"
                      @click="showDialog('feeDept', scope.$index)"
                    ></i>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="物料名称" v-if="docTypeStandard.length">
              <template slot-scope="scope">
                <el-form-item
                  prop="materialName"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.materialName" clearable disabled>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="计价单位">
              <template slot-scope="scope">
                <el-form-item prop="unit" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.unit" clearable readonly>
                    <i
                      slot="suffix"
                      class="el-input__icon el-icon-notebook-2"
                      style="cursor: pointer"
                      @click="showDialog('unit', scope.$index)"
                    ></i>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="含税单价">
              <template slot-scope="scope">
                <el-form-item
                  prop="taxPrice"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.taxPrice" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="单价">
              <template slot-scope="scope">
                <el-form-item prop="price" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.price" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="税率%">
              <template slot-scope="scope">
                <el-form-item prop="rate" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.rate" clearable readonly>
                    <i
                      slot="suffix"
                      class="el-input__icon el-icon-notebook-2"
                      style="cursor: pointer"
                      @click="showDialog('rate', scope.$index)"
                    ></i>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="折扣率%">
              <template slot-scope="scope">
                <el-form-item
                  prop="discountRate"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.discountRate" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="不含税金额">
              <template slot-scope="scope">
                <el-form-item
                  prop="notTaxAmount"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.notTaxAmount" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="折扣额">
              <template slot-scope="scope">
                <el-form-item
                  prop="discountAmount"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.discountAmount" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="税额">
              <template slot-scope="scope">
                <el-form-item
                  prop="rateAmount"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.rateAmount" clearable></el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="销售订单">
              <template slot-scope="scope">
                <el-form-item
                  prop="saleOrderId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.saleOrderId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="数量">
              <template slot-scope="scope">
                <el-form-item prop="num" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.num" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>

            <el-table-column label="出库单">
              <template slot-scope="scope">
                <el-form-item
                  prop="inOutStorageId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.inOutStorageId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="销售开票">
              <template slot-scope="scope">
                <el-form-item
                  prop="invoiceReceivableId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.invoiceReceivableId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
          </el-table>
        </el-collapse-item>
        <el-collapse-item title="收款计划" name="plan">
          <el-table
            :data="formData.kingInvoicePayableProcurePlanEntities"
            style="width: 100%"
            highlight-current-row
            border
          >
            <template #empty>
              <el-button plain type="primary" round @click="addNewRow('plan')"
                >添加新行
              </el-button>
            </template>
            <el-table-column label="操作" width="120" fixed>
              <template slot-scope="scope">
                <el-button
                  plain
                  icon="el-icon-plus"
                  size="mini"
                  @click="handleDataAdd(scope.$index, scope.row, 'plan')"
                ></el-button>
                <el-button
                  plain
                  icon="el-icon-minus"
                  size="mini"
                  @click="handleDataDelete(scope.$index, scope.row, 'plan')"
                ></el-button>
              </template>
            </el-table-column>
            <el-table-column
              label="序号"
              type="index"
              align="center"
            ></el-table-column>
            <el-table-column label="销售开票">
              <template slot-scope="scope">
                <el-form-item
                  prop="invoiceReceivableId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.invoiceReceivableId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="销售订单">
              <template slot-scope="scope">
                <el-form-item
                  prop="saleOrderId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.saleOrderId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="应收金额">
              <template slot-scope="scope">
                <el-form-item
                  prop="receiptAmount"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.receiptAmount" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="按比例收%">
              <template slot-scope="scope">
                <el-form-item
                  prop="receiptRatio"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.receiptRatio" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="到期日">
              <template slot-scope="scope">
                <el-form-item
                  prop="createTime"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-date-picker
                    v-model="scope.row.createTime"
                    type="date"
                    placeholder="选择日期"
                  >
                  </el-date-picker>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="备注">
              <template slot-scope="scope">
                <el-form-item
                  prop="remarks"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.remarks" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
          </el-table>
        </el-collapse-item>
        <el-collapse-item title="销售订单" name="order">
          <el-table
            :data="formData.orderEntities"
            style="width: 100%"
            highlight-current-row
            border
          >
            <template #empty>
              <el-button plain type="primary" round @click="addNewRow('order')"
                >添加新行
              </el-button>
            </template>
            <el-table-column label="操作" width="120" fixed>
              <template slot-scope="scope">
                <el-button
                  plain
                  icon="el-icon-plus"
                  size="mini"
                  @click="handleDataAdd(scope.$index, scope.row, 'order')"
                ></el-button>
                <el-button
                  plain
                  icon="el-icon-minus"
                  size="mini"
                  @click="handleDataDelete(scope.$index, scope.row, 'order')"
                ></el-button>
              </template>
            </el-table-column>
            <el-table-column
              label="序号"
              type="index"
              align="center"
            ></el-table-column>
            <el-table-column label="业务类型">
              <template slot-scope="scope">
                <el-form-item
                  prop="businessType"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.businessType" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="变更原因">
              <template slot-scope="scope">
                <el-form-item
                  prop="changeReason"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.changeReason" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="币别">
              <template slot-scope="scope">
                <el-form-item
                  prop="currency"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.currency" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="客户">
              <template slot-scope="scope">
                <el-form-item
                  prop="customerId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.customerId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="客户名称">
              <template slot-scope="scope">
                <el-form-item
                  prop="customerName"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.customerName"> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="交货地点">
              <template slot-scope="scope">
                <el-form-item
                  prop="deliveryAddress"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.deliveryAddress" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="交货方式">
              <template slot-scope="scope">
                <el-form-item
                  prop="deliveryMethod"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.deliveryMethod" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="所属公司">
              <template slot-scope="scope">
                <el-form-item prop="deptId" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.deptId" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="折扣表">
              <template slot-scope="scope">
                <el-form-item
                  prop="discountInfoId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.discountInfoId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="流程实例">
              <template slot-scope="scope">
                <el-form-item
                  prop="instanceId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.instanceId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="是否含税">
              <template slot-scope="scope">
                <el-form-item prop="isTax" label-width="0px" style="margin: 0">
                  <el-select
                    v-model="scope.row.isTax"
                    placeholder="请选择"
                    style="width: 100%"
                  >
                    <el-option label="否" value="0"> </el-option>
                    <el-option label="是" value="1"> </el-option>
                  </el-select>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="单据编码">
              <template slot-scope="scope">
                <el-form-item
                  prop="kingDocCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.kingDocCode" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="单据类型">
              <template slot-scope="scope">
                <el-form-item
                  prop="kingDocTypeId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.kingDocTypeId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="层级">
              <template slot-scope="scope">
                <el-form-item prop="level" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.level" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="保证金">
              <template slot-scope="scope">
                <el-form-item prop="margin" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.margin" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="保证金比例">
              <template slot-scope="scope">
                <el-form-item
                  prop="marginLevel"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.marginLevel" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="流程模型">
              <template slot-scope="scope">
                <el-form-item
                  prop="modelId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.modelId" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="源订单编号">
              <template slot-scope="scope">
                <el-form-item
                  prop="originalOrderCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.originalOrderCode" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="付款方">
              <template slot-scope="scope">
                <el-form-item prop="payer" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.payer" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="收款条件">
              <template slot-scope="scope">
                <el-form-item
                  prop="paymentTerms"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.paymentTerms" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="是否价格税">
              <template slot-scope="scope">
                <el-form-item
                  prop="priceTax"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-select
                    v-model="scope.row.priceTax"
                    placeholder="请选择"
                    style="width: 100%"
                  >
                    <el-option label="否" value="0"> </el-option>
                    <el-option label="是" value="1"> </el-option>
                  </el-select>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="价目表">
              <template slot-scope="scope">
                <el-form-item
                  prop="priceinfoId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.priceinfoId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="汇款">
              <template slot-scope="scope">
                <el-form-item prop="rate" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.rate" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="汇率类型">
              <template slot-scope="scope">
                <el-form-item
                  prop="rateType"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.rateType" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="收货方">
              <template slot-scope="scope">
                <el-form-item
                  prop="receivingParty"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.receivingParty" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="订单编号">
              <template slot-scope="scope">
                <el-form-item
                  prop="saleCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.saleCode" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="日期">
              <template slot-scope="scope">
                <el-form-item
                  prop="saleDate"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.saleDate" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="销售部门">
              <template slot-scope="scope">
                <el-form-item
                  prop="saleDept"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.saleDept" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="销售组">
              <template slot-scope="scope">
                <el-form-item
                  prop="saleGroup"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.saleGroup" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="销售员">
              <template slot-scope="scope">
                <el-form-item prop="saleId" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.saleId" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="结算方">
              <template slot-scope="scope">
                <el-form-item
                  prop="settlementParty"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.settlementParty" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="结算方式">
              <template slot-scope="scope">
                <el-form-item
                  prop="settlementType"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.settlementType" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="收货地址">
              <template slot-scope="scope">
                <el-form-item
                  prop="shippingAddress"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.shippingAddress" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="收货联系人">
              <template slot-scope="scope">
                <el-form-item
                  prop="shippingPerson"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.shippingPerson" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="收货人姓名">
              <template slot-scope="scope">
                <el-form-item
                  prop="shippingPersonName"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.shippingPersonName" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="联系人方式">
              <template slot-scope="scope">
                <el-form-item
                  prop="shippingPhone"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.shippingPhone" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="源单类型">
              <template slot-scope="scope">
                <el-form-item
                  prop="sourceDocType"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-select
                    v-model="scope.row.sourceDocType"
                    placeholder="请选择"
                    style="width: 100%"
                  >
                    <el-option label="销售合同" value="0"> </el-option>
                    <el-option label="销售报价单" value="1"> </el-option>
                  </el-select>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="单据类型名称">
              <template slot-scope="scope">
                <el-form-item
                  prop="sourceDocTypeName"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.sourceDocTypeName" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="审核状态">
              <template slot-scope="scope">
                <el-form-item prop="state" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.state" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="税额">
              <template slot-scope="scope">
                <el-form-item
                  prop="taxAmount"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.taxAmount" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="变更状态">
              <template slot-scope="scope">
                <el-form-item
                  prop="updateState"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-select
                    v-model="scope.row.updateState"
                    placeholder="请选择"
                    style="width: 100%"
                  >
                    <el-option label="未变更" value="0"> </el-option>
                    <el-option label="已变更" value="1"> </el-option>
                  </el-select>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="金额">
              <template slot-scope="scope">
                <el-form-item
                  prop="valueTax"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.valueTax" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
          </el-table>
        </el-collapse-item>
        <el-collapse-item title="出入库单记录" name="storage">
          <el-table
            :data="formData.kingInventoryEntities"
            style="width: 100%"
            highlight-current-row
            border
          >
            <template #empty>
              <el-button
                plain
                type="primary"
                round
                @click="addNewRow('storage')"
                >添加新行
              </el-button>
            </template>
            <el-table-column label="操作" width="120" fixed>
              <template slot-scope="scope">
                <el-button
                  plain
                  icon="el-icon-plus"
                  size="mini"
                  @click="handleDataAdd(scope.$index, scope.row, 'storage')"
                ></el-button>
                <el-button
                  plain
                  icon="el-icon-minus"
                  size="mini"
                  @click="handleDataDelete(scope.$index, scope.row, 'storage')"
                ></el-button>
              </template>
            </el-table-column>
            <el-table-column
              label="序号"
              type="index"
              align="center"
            ></el-table-column>
            <el-table-column label="入库批次号">
              <template slot-scope="scope">
                <el-form-item
                  prop="batchNumber"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.batchNumber" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="合同">
              <template slot-scope="scope">
                <el-form-item
                  prop="contractId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.contractId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="入库类型">
              <template slot-scope="scope">
                <el-form-item
                  prop="inStorageType"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-select
                    v-model="scope.row.inStorageType"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                  >
                    <el-option label="甲供入库 " value="1"></el-option>
                    <el-option label="自购入库 " value="2"></el-option>
                  </el-select>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="出入库日期">
              <template slot-scope="scope">
                <el-form-item
                  prop="inOutTime"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-date-picker
                    v-model="scope.row.inOutTime"
                    type="date"
                    placeholder="选择日期"
                  >
                  </el-date-picker>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="订单">
              <template slot-scope="scope">
                <el-form-item
                  prop="orderId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.orderId" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="项目">
              <template slot-scope="scope">
                <el-form-item
                  prop="projectId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.projectId" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="出入库单号">
              <template slot-scope="scope">
                <el-form-item
                  prop="purchaseCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.purchaseCode" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="流程状态">
              <template slot-scope="scope">
                <el-form-item prop="state" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.state" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="供应商">
              <template slot-scope="scope">
                <el-form-item
                  prop="supplierId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.supplierId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="出入库类型">
              <template slot-scope="scope">
                <el-form-item prop="type" label-width="0px" style="margin: 0">
                  <el-select
                    v-model="scope.row.type"
                    placeholder="请选择"
                    clearable
                    :style="{ width: '100%' }"
                  >
                    <el-option label="入库 " value="1"></el-option>
                    <el-option label="出库 " value="2"></el-option>
                  </el-select>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="领用人">
              <template slot-scope="scope">
                <el-form-item
                  prop="useUserId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.useUserId" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="仓库">
              <template slot-scope="scope">
                <el-form-item
                  prop="warehouseId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.warehouseId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="仓库区域">
              <template slot-scope="scope">
                <el-form-item
                  prop="warehouseRegionId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.warehouseRegionId" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="备注">
              <template slot-scope="scope">
                <el-form-item
                  prop="remarks"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.remarks" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
          </el-table>
        </el-collapse-item>
        <el-collapse-item title="退料单" name="refund">
          <el-table
            :data="formData.kingInventoryEntities"
            style="width: 100%"
            highlight-current-row
            border
          >
            <template #empty>
              <el-button
                plain
                type="primary"
                round
                @click="addNewRow('storage')"
                >添加新行
              </el-button>
            </template>
            <el-table-column label="操作" width="120" fixed>
              <template slot-scope="scope">
                <el-button
                  plain
                  icon="el-icon-plus"
                  size="mini"
                  @click="handleDataAdd(scope.$index, scope.row, 'storage')"
                ></el-button>
                <el-button
                  plain
                  icon="el-icon-minus"
                  size="mini"
                  @click="handleDataDelete(scope.$index, scope.row, 'storage')"
                ></el-button>
              </template>
            </el-table-column>
            <el-table-column
              label="序号"
              type="index"
              align="center"
            ></el-table-column>
            <el-table-column label="结算方编码">
              <template slot-scope="scope">
                <el-form-item
                  prop="balanceCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.balanceCode" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="结算方名称">
              <template slot-scope="scope">
                <el-form-item
                  prop="balanceId"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.balanceId" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="本位币">
              <template slot-scope="scope">
                <el-form-item
                  prop="baseCurrency"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.baseCurrency" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="货主客户">
              <template slot-scope="scope">
                <el-form-item
                  prop="cargoCustomer"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.cargoCustomer" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="货主">
              <template slot-scope="scope">
                <el-form-item
                  prop="cargoOwner"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.cargoOwner" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="货主类型">
              <template slot-scope="scope">
                <el-form-item
                  prop="cargoOwnerType"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.cargoOwnerType" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="验收方式">
              <template slot-scope="scope">
                <el-form-item
                  prop="checkMethod"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.checkMethod" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="确认人">
              <template slot-scope="scope">
                <el-form-item
                  prop="confirmName"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.confirmName" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="确认状态">
              <template slot-scope="scope">
                <el-form-item
                  prop="confirmState"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.confirmState" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="确认日期">
              <template slot-scope="scope">
                <el-form-item
                  prop="confirmTime"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-date-picker
                    clearable
                    v-model="scope.row.confirmTime"
                    type="date"
                    placeholder="选择日期"
                    format="yyyy-MM-dd"
                    value-format="yyyy-MM-dd"
                  >
                  </el-date-picker>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="创建人">
              <template slot-scope="scope">
                <el-form-item
                  prop="createName"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.createName" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="折扣表">
              <template slot-scope="scope">
                <el-form-item
                  prop="discountInfoCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.discountInfoCode" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="业务类型">
              <template slot-scope="scope">
                <el-form-item
                  prop="docBusinessType"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.docBusinessType" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="退料单编码">
              <template slot-scope="scope">
                <el-form-item
                  prop="docCode"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.docCode" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="单据状态">
              <template slot-scope="scope">
                <el-form-item
                  prop="docStatus"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.docStatus" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="邮箱">
              <template slot-scope="scope">
                <el-form-item prop="email" label-width="0px" style="margin: 0">
                  <el-input v-model="scope.row.email" clearable> </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="审核人">
              <template slot-scope="scope">
                <el-form-item
                  prop="examineName"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.examineName" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="审核日期">
              <template slot-scope="scope">
                <el-form-item
                  prop="examineTime"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-date-picker
                    v-model="scope.row.examineTime"
                    clearable
                    type="date"
                    placeholder="选择日期"
                    format="yyyy-MM-dd"
                    value-format="yyyy-MM-dd"
                  >
                  </el-date-picker>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="汇率">
              <template slot-scope="scope">
                <el-form-item
                  prop="exchangeRate"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.exchangeRate" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="汇率类型">
              <template slot-scope="scope">
                <el-form-item
                  prop="exchangeRateType"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.exchangeRateType" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="库存组">
              <template slot-scope="scope">
                <el-form-item
                  prop="inventoryGroup"
                  label-width="0px"
                  style="margin: 0"
                >
                  <el-input v-model="scope.row.inventoryGroup" clearable>
                  </el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <!-- <el-table-column label="是否含价外税">
                            <template slot-scope="scope">
                                <el-form-item
                                    prop="isExtraPriceTax"
                                    label-width="0px"
                                    style="margin: 0"
                                >
                                    <el-input
                                        v-model="scope.row.isExtraPriceTax"
                                        clearable
                                    >
                                    </el-input>
                                </el-form-item>
                            </template>
                        </el-table-column> -->
          </el-table>
        </el-collapse-item>
      </el-collapse>
    </el-form>
    <el-dialog
      :title="dialogTitle"
      :visible.sync="open"
      width="50%"
      :before-close="handleClose"
      append-to-body
      destroy-on-close
    >
      <components :is="currentCom" @getSelectVal="getSelectVal" />
      <span slot="footer" class="dialog-footer">
        <el-button @click="cancelSelect">取 消</el-button>
        <el-button type="primary" @click="confirmSelect">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { getDocTypeList } from "@/api/system/purchase";
import { addInfo } from "@/api/finance/procureInvoice";
import Customer from "./dialog/customer.vue";
import Currency from "./dialog/currencys.vue";
import Receipt from "./dialog/receipt.vue";
import Dept from "./dialog/dept.vue";
import SaleUser from "./dialog/saleUser.vue";
import Material from "./dialog/materials.vue";
import TaxRate from "./dialog/taxRates.vue";
import Unit from "./dialog/units.vue";
import Fee from "./dialog/fee.vue";
import FeeDept from "./dialog/feeDept.vue";
import Supplier from "./dialog/supplier.vue";
import PayTerms from "./dialog/payTerms.vue";
export default {
  props: ["rowId"],
  components: {
    Customer,
    Currency,
    Receipt,
    Dept,
    SaleUser,
    Material,
    TaxRate,
    Unit,
    Fee,
    FeeDept,
    Supplier,
    PayTerms,
  },
  data() {
    return {
      activeName: ["basic", "detail", "plan", "order", "storage", "refund"],
      dialogTitle: "",
      open: false,
      selectItem: [],
      docTypeStandard: [],
      docTypeExpanse: [],
      currentCom: "",
      formData: {
        kingInventoryEntities: [],
        kingInvoicePayableDetailEntities: [],
        kingInvoicePayableEntity: {
          accountType: "",
          bizTime: "",
          businessType: "13",
          createBy: "",
          createTime: "",
          currencyCode: "",
          currencyId: "",
          currencyName: "",
          deptId: "",
          discountAmount: "",
          docNo: "",
          docTypeCode: "",
          dueCalculationTime: "",
          dueTime: "",
          forderCode: "",
          goodsCode: "",
          goodsSupplierId: "",
          id: "",
          instanceId: "",
          isExtraPriceTax: "",
          isFee: "",
          isIncludeTaxPrice: "",
          isSend: 0,
          isTaxCostAmount: "",
          isTicketsBefore: "",

          modelId: "",
          orderSupplierId: "",
          pageNo: 0,
          pageSize: 0,
          params: {},
          parentId: "",
          payDeptId: "",
          payTermsId: "",
          procureCompany: "",
          procureCompanyId: "",
          procureDeptCode: "",
          procureDeptId: "",
          procureDeptName: "",
          procureUser: "",
          procureUserId: "",
          receiptCode: "",
          receiptSupplierId: "",
          remark: "",
          remarks: "",
          searchValue: "",
          settlementCode: "",
          settlementDept: "",
          settlementDeptId: "",
          settlementTypeId: "",
          sourceDocType: 0,
          state: "",
          status: "",
          supplierCode: "",
          supplierId: "",
          supplierName: "",
          totalTaxPrice: "",
          updateBy: "",
          updateTime: "",
        },
        kingInvoicePayableProcurePlanEntities: [],
        orderEntities: [],
        kingProcureRefundEntities: [],
      },
      rules: {
        kingInvoicePayableEntity: {
          docTypeId: [
            {
              required: true,
              type: "array",
              message: "请选择单据类型",
              trigger: "change",
            },
          ],
          supplierName: [
            {
              required: true,
              message: "请选择供应商",
              trigger: "blur",
            },
          ],
          currencyName: [
            {
              required: true,
              message: "请选择币别",
              trigger: "blur",
            },
          ],
          // settlementDeptId: [
          //     {
          //         required: true,
          //         message: "请输入结算组织",
          //         trigger: "blur",
          //     },
          // ],
          bizTime: [
            {
              required: true,
              message: "请选择业务时间",
              trigger: "change",
            },
          ],
          totalTaxAmount: [],
          // receiptDeptId: [
          //     {
          //         required: true,
          //         message: "请输入收款组织",
          //         trigger: "blur",
          //     },
          // ],
          dueTime: [
            {
              required: true,
              message: "请选择到期日",
              trigger: "change",
            },
          ],
        },
      },
      accountTypeOptions: [
        {
          label: "暂估应付",
          value: "2",
        },
        {
          label: "财务应付",
          value: "3",
        },
      ],
      docTypeIdOptions: [],
      isExtraPriceTaxOptions: [
        {
          label: "是",
          value: "1",
        },
        {
          label: "否",
          value: "2",
        },
      ],
      isFeeOptions: [
        {
          label: "是",
          value: "1",
        },
        {
          label: "否",
          value: "2",
        },
      ],
      isIncludeTaxPriceOptions: [
        {
          label: "是",
          value: "1",
        },
        {
          label: "否",
          value: "2",
        },
      ],
      docTypeIdProps: {
        multiple: false,
      },
      isTaxCostAmountOptions: [
        {
          label: "是",
          value: "1",
        },
        {
          label: "否",
          value: "2",
        },
      ],
      isTicketsBeforeOptions: [
        {
          label: "是",
          value: "1",
        },
        {
          label: "否",
          value: "2",
        },
      ],
      props: {},
      dialogType: "",
    };
  },
  methods: {
    handleChange() {},
    // 新增新行
    addNewRow(type) {
      const nameMap = {
        detail: () => {
          let obj = {
            baseUnit: "",
            batchNum: "",
            bearDeptCode: "",
            bearDeptName: "",
            createBy: "",
            createTime: "",
            deptId: "",
            discountAmount: "",
            discountRate: "",
            feeCode: "",
            feeName: "",
            id: "",
            inStorageNo: "",
            invoicePayableId: "",
            isGift: 0,
            isIncludeContractCost: 0,
            isIncludeProcureCost: 0,

            materialCode: "",
            materialId: "",
            materialName: "",
            notTaxAmount: "",
            num: "",
            orderId: "",
            outStorageNo: "",
            pageNo: 0,
            pageSize: 0,
            params: {},
            rate: "",
            rateAmount: "",
            remark: "",
            searchValue: "",
            sourceDocId: "",
            sourceDocType: 0,
            taxPrice: "",
            totalTaxPrice: "",
            unit: "",
            updateBy: "",
            updateTime: "",
          };
          this.formData.kingInvoicePayableDetailEntities.push(obj);
        },
        plan: () => {
          let obj = {
            createBy: "",
            createTime: "",
            dueTime: "",
            feeId: "",
            id: "",
            invoicePayableId: "",

            materialId: "",
            ownCurrencyId: "",
            pageNo: 0,
            pageSize: 0,
            params: {},
            payAmount: "",
            payRatio: "",
            procureOrderId: "",
            remark: "",
            remarks: "",
            searchValue: "",
            updateBy: "",
            updateTime: "",
          };
          this.formData.kingInvoicePayableProcurePlanEntities.push(obj);
        },
        order: () => {
          let obj = {
            applyFormUnpaidAmount: "",
            applyId: "",
            applyTime: "",
            baseCurrency: "",
            businessType: "",
            changeReason: "",
            changeTime: "",
            checkMethod: "",
            closeName: "",
            closeReason: "",
            closeState: "",
            closeTime: "",
            confirmName: "",
            confirmState: "",
            confirmTime: "",
            createId: "",
            createName: "",
            createTime: "",
            discountInfoId: "",
            docBusinessType: "",
            docType: "",
            documentCode: "",
            ensure: "",
            ensureRate: "",
            examineName: "",
            examineTime: "",
            exchangeRate: "",
            exchangeRateType: "",
            focusSettlementDept: "",
            id: "",
            instanceId: "",
            invalidName: "",
            invalidState: "",
            invalidTime: "",
            isExtraPriceTax: true,
            isManualClose: true,
            isSend: 0,
            isTax: true,
            isTemp: true,

            lastUpdateName: "",
            lastUpdateTime: "",
            level: 0,
            limit: 0,
            modelId: "",
            money: "",
            moneyAmount: "",
            moneyAmountBase: "",
            orderDetails: [
              {
                amountMoney: "",
                batchNum: "",
                businessTaxCostPrice: "",
                changeTime: "",
                changeType: "",
                createTime: "",
                deliveryAddress: "",
                deliveryDate: "",
                deliveryLocation: "",
                discountAmount: "",
                discountRate: "",
                executeStatus: "",
                id: "",
                inventoryId: "",
                inventoryNum: 0,
                inventoryUnit: "",
                isGiveaway: true,

                limit: 0,
                material: {
                  allowAsset: "",
                  allowInventory: "",
                  allowOutsource: "",
                  allowProduce: "",
                  allowPurchase: "",
                  allowSale: "",
                  barCode: "",
                  brand: "",
                  businessType: "",
                  configurationProduction: "",
                  costPriceRatio: "",
                  createBy: "",
                  createTime: "",
                  dataState: "",
                  defaultTaxRate: "",
                  deptId: "",
                  disableBy: "",
                  examineBy: "",
                  examineTime: "",
                  grossWeight: "",
                  heightStr: "",
                  id: "",
                  imgUrl: "",
                  instanceId: "",
                  inventoryType: "",
                  isChange: "",

                  kit: "",
                  lengthStr: "",
                  materialCode: "",
                  materialDesc: "",
                  materialGroup: "",
                  materialInventoryEntity: {
                    batchInfo: "",
                    batchRule: "",
                    checkCycle: "",
                    convertDirection: "",
                    costUnit: "",
                    createBy: "",
                    createTime: "",
                    currency: "",
                    day: "",
                    economicOrderingBatch: "",
                    id: "",
                    inventoryUnit: "",
                    isBatch: "",
                    isCheck: "",
                    isLock: "",
                    isMaxInventory: "",
                    isMinInventory: "",
                    isOrderGoods: "",
                    isSafeInventory: "",
                    isTrueCheck: "",
                    materialId: "",
                    maxInventoyNum: "",
                    minInventoryNum: "",
                    orderGoodsNum: "",
                    pageNo: 0,
                    pageSize: 0,
                    params: {},
                    qualityManage: "",
                    qualityNum: "",
                    qualityUnit: "",
                    referenceCost: "",
                    remark: "",
                    safeInventoryNum: "",
                    searchValue: "",
                    serviceLife: "",
                    standardNumber: "",
                    supportUnit: "",
                    updateBy: "",
                    updateTime: "",
                    warePosition: "",
                    warehouseCode: "",
                  },
                  materialName: "",
                  materialPlanAttributeEntity: {
                    createBy: "",
                    createTime: "",
                    fAllowPartDelay: "",
                    fBaseVarLeadTimeLotSize: "",
                    fBaseVarLeadTimeLotSizeUnit: "",
                    fCanDelayDays: 0,
                    fCanLeadDays: 0,
                    fCheckLeadTime: 0,
                    fCheckLeadTimeType: "",
                    fDelayExtendDay: 0,
                    fFixLeadTime: 0,
                    fFixLeadTimeType: "",
                    fIncreaseQty: 0,
                    fIncreaseQtyUnit: "",
                    fIsMrpComBill: "",
                    fIsMrpComReq: "",
                    fLeadExtendDay: 0,
                    fMaxPoqty: 0,
                    fMfgPolicyId: "",
                    fMinPoqty: 0,
                    fMinPoqtyUnit: "",
                    fOrderIntervalTime: 0,
                    fOrderIntervalTimeType: "",
                    fOrderPolicy: "",
                    fPlanBatchSplitQty: "",
                    fPlanBatchSplitQtyUnit: "",
                    fPlanGroupId: "",
                    fPlanIdent: "",
                    fPlanIntervalsDays: 0,
                    fPlanOffsetTime: 0,
                    fPlanOffsetTimeType: "",
                    fPlanSafeStockQty: 0,
                    fPlanSafeStockQtyUnit: "",
                    fPlanTimeZone: 0,
                    fPlanWorkshop: "",
                    fPlanerId: "",
                    fPlanningStrategy: "",
                    fProScheTrackId: "",
                    fProductLine: "",
                    fRequestTimeZone: 0,
                    fSupplySourceId: "",
                    fVarLeadTime: 0,
                    fVarLeadTimeLotSize: "",
                    fVarLeadTimeLotSizeUnit: "",
                    fVarLeadTimeType: "",
                    fWriteOffQty: "",
                    fWriteOffQtyUnit: "",
                    id: "",
                    materialId: "",
                    maxPoqtyUnit: "",
                    pageNo: 0,
                    pageSize: 0,
                    params: {},
                    remark: "",
                    searchValue: "",
                    updateBy: "",
                    updateTime: "",
                  },
                  materialProcureEntity: {
                    agentProcure: "",
                    barCodeRule: "",
                    createBy: "",
                    createTime: "",
                    dayProduction: 0,
                    dayProductionUnit: "",
                    defaultSupplier: "",
                    defunctProductionLine: "",
                    expenseItem: "",
                    id: "",
                    isControl: "",
                    isDayProduction: "",
                    isMaterialReturn: "",
                    isQuota: "",
                    isReq: "",
                    materialId: "",
                    minPackNum: "",
                    minSpiltNum: 0,
                    outsourcePricingUnit: "",
                    outsourceType: "",
                    outsourceUnit: "",
                    pageNo: 0,
                    pageSize: 0,
                    params: {},
                    procureGroup: "",
                    procureId: "",
                    procurePricingUnit: "",
                    procureType: "",
                    procureUnit: "",
                    quotaMode: "",
                    remark: "",
                    repeatPutNum: "",
                    searchValue: "",
                    takeOverDelay: 0,
                    takeOverDown: "",
                    takeOverLead: 0,
                    takeOverUp: "",
                    updateBy: "",
                    updateTime: "",
                  },
                  materialProductEntity: {
                    createBy: "",
                    createTime: "",
                    deptId: "",
                    fBackFlushType: "",
                    fConsumVolatility: "",
                    fDefaultLineId: "",
                    fDefaultRouting: "",
                    fFinishReceiptOverRate: "",
                    fFinishReceiptShortRate: "",
                    fIsCompleteSet: "",
                    fIsEnableSchedule: "",
                    fIsKitting: "",
                    fIsMainPrd: "",
                    fIsMinissueQty: "",
                    fIsProductLine: "",
                    fIsSNCarryToParent: "",
                    fIssueType: "",
                    fMdlId: "",
                    fMdlMaterialId: "",
                    fMinissueQty: 0,
                    fMinissueUnitId: "",
                    fOrgTrustBillType: "",
                    fOverControlMode: "",
                    fPerUnitStandHour: "",
                    fPickBinId: "",
                    fPickStockId: "",
                    fProduceBillType: "",
                    fProduceUnitId: "",
                    fStandHourUnitId: "",
                    fStdLaborPrePareTime: "",
                    fStdLaborProcessTime: "",
                    fStdMachinePrepareTime: "",
                    fStdMachineProcessTime: "",
                    fWorkShopId: "",
                    fbkfltime: "",
                    fbomunitid: "",
                    ffixloss: "",
                    fisecn: "",
                    flosspercent: "",
                    id: "",
                    materialId: "",
                    pageNo: 0,
                    pageSize: 0,
                    params: {},
                    remark: "",
                    searchValue: "",
                    updateBy: "",
                    updateTime: "",
                  },
                  materialProperty: "",
                  materialQualityEntity: {
                    createBy: "",
                    createTime: "",
                    fCheckDelivery: "",
                    fCheckEntrusted: "",
                    fCheckIncoming: "",
                    fCheckOther: "",
                    fCheckProduct: "",
                    fCheckReturn: "",
                    fCheckStock: "",
                    fCheckSubFtnMtrl: "",
                    fEWLeadDay: "",
                    fEnableCyclistQCSTK: "",
                    fEnableCyclistQcstkew: "",
                    fFirstQCControlType: "",
                    fIncQcSchemeId: "",
                    fIncSampSchemeId: "",
                    fInspectGroupId: "",
                    fInspectorId: "",
                    fIsFirstInspect: "",
                    fStockCycle: "",
                    id: "",
                    materialId: "",
                    pageNo: 0,
                    pageSize: 0,
                    params: {},
                    remark: "",
                    searchValue: "",
                    updateBy: "",
                    updateTime: "",
                  },
                  materialSaleEntity: {
                    allowReleaseOrder: "",
                    allowReturns: "",
                    atpCheck: "",
                    controlSurpassUnit: "",
                    createBy: "",
                    createTime: "",
                    dropOutCount: "",
                    fisReturnPart: "",
                    fisaftersale: "",
                    fisproductfiles: "",
                    fiswarranted: "",
                    fwarranty: "",
                    fwarrantyunitid: "",
                    id: "",
                    isFavourableTax: "",
                    materialId: "",
                    pageNo: 0,
                    pageSize: 0,
                    params: {},
                    remark: "",
                    saleDownPrice: "",
                    saleGroup: "",
                    saleOutbound: "",
                    salePricingUnit: "",
                    saleUnit: "",
                    searchValue: "",
                    startOrderNum: 0,
                    surpassDown: "",
                    surpassUp: "",
                    taxType: "",
                    taxTypeCode: "",
                    updateBy: "",
                    updateTime: "",
                  },
                  mnemonicCode: "",
                  model: "",
                  modelId: "",
                  netWeight: "",
                  oldMaterialCode: "",
                  pageNo: 0,
                  pageSize: 0,
                  params: {},
                  reasonForDisable: "",
                  remark: "",
                  searchValue: "",
                  sizeUnit: "",
                  state: "",
                  subItems: "",
                  taxType: "",
                  typeName: "",
                  unit: "",
                  updateBy: "",
                  updateTime: "",
                  volume: "",
                  weightUnit: "",
                  wideStr: "",
                },
                materialChangeEntity: {},
                materialCode: "",
                materialId: "",
                netAmount: "",
                noTaxMoney: "",
                number: 0,
                orderDelivery: {
                  batchNum: "",
                  bomVer: "",
                  changeTime: "",
                  controlDeliveryNum: true,
                  controlDeliveryTime: true,
                  createTime: "",
                  deliveryDelayDay: "",
                  deliveryDown: "",
                  deliveryEarlyTime: "",
                  deliveryLatestTime: "",
                  deliveryLeadDay: "",
                  deliveryUp: "",
                  id: "",

                  materialId: "",
                  materialName: "",
                  orderDeliveryDetails: [
                    {
                      address: "",
                      changeTime: "",
                      confirmComment: "",
                      confirmNum: "",
                      confirmTime: "",
                      createTime: "",
                      deliveredNum: "",
                      deliveryTime: "",
                      id: "",

                      location: "",
                      num: "",
                      orderDeliveryId: "",
                      orderId: "",
                      planUnit: "",
                      surplusNum: "",
                      userId: "",
                    },
                  ],
                  orderId: "",
                  receiveDept: "",
                  receiveOrg: "",
                  requireDept: "",
                  requireOrg: "",
                  supplierBatch: "",
                  supportAttr: "",
                  userId: "",
                },
                orderFinanceDetail: {
                  changeTime: "",
                  createTime: "",
                  discountAmount: "",
                  discountRate: "",
                  entryPriceInfo: "",
                  id: "",

                  materialCode: "",
                  materialId: "",
                  materialName: "",
                  netPrice: "",
                  orderId: "",
                  priceCeiling: "",
                  priceCoefficient: "",
                  priceFloor: "",
                  pricingNum: "",
                  pricingUnit: "",
                  settlementDept: "",
                  systemPricing: "",
                  taxRate: "",
                  unitPriceDiscount: "",
                  userId: "",
                },
                orderOther: {
                  businessClose: "",
                  businessFreeze: "",
                  businessProcess: "",
                  businessStop: "",
                  changeTime: "",
                  contractsCode: "",
                  createTime: "",
                  freezeName: "",
                  freezeTime: "",
                  id: "",
                  inventoryReturnNum: "",
                  isPlanConfirm: "",
                  isQuotaGeneration: "",

                  materialCode: "",
                  materialId: "",
                  materialName: "",
                  materialReceivedReturnNum: "",
                  orderId: "",
                  planTrackingCode: "",
                  requireDocCode: "",
                  requireDocLineCode: "",
                  requireFrom: "",
                  requireTrackingCode: "",
                  sourceDocCode: "",
                  sourceDocType: "",
                  stopName: "",
                  stopTime: "",
                  surplusInboundNum: "",
                  surplusMaterialReceivedNum: "",
                  totalInboundNum: "",
                  totalMaterialReceivedNum: "",
                  totalMaterialReturnNum: "",
                  updateFlag: "",
                  userId: "",
                },
                originalContainsTaxPrice: "",
                originalNumber: "",
                page: 0,
                parentMaterial: "",
                price: "",
                pricingNum: "",
                pricingUnit: "",
                purchaseUnit: "",
                ramarks: "",
                receivedFirstTicketsNum: "",
                receivingDept: "",
                relationId: "",
                requireDept: "",
                saleOrderDelivery: {
                  createBy: "",
                  createTime: "",
                  deliveryDown: "",
                  deliveryType: "",
                  deliveryUnit: "",
                  deliveryUp: "",
                  id: "",
                  inventoryDept: "",

                  materialCode: "",
                  materialName: "",
                  orderId: "",
                  pageNo: 0,
                  pageSize: 0,
                  params: {},
                  remark: "",
                  saleOrderDeliveryDetailEntities: [
                    {
                      createBy: "",
                      createTime: "",
                      deliveryAddress: "",
                      deliveryAddressDetail: "",
                      deliveryDate: "",
                      deliveryId: "",
                      id: "",
                      inAdvance: "",

                      pageNo: 0,
                      pageSize: 0,
                      params: {},
                      planDeliveryDate: "",
                      remark: "",
                      saleNum: "",
                      saleUnit: "",
                      searchValue: "",
                      updateBy: "",
                      updateTime: "",
                    },
                  ],
                  searchValue: "",
                  updateBy: "",
                  updateTime: "",
                },
                settlementDept: "",
                sourceDocCode: "",
                sourceDocType: "",
                sourceRelationId: "",
                supplierMaterialCode: "",
                supplierMaterialName: "",
                taxAmount: "",
                taxMoney: "",
                taxPrice: "",
                taxRate: "",
                token: "",
                totalAcceptanceAmount: "",
                totalAcceptanceRate: "",
                totalTaxPrice: "",
                type: 0,
                warehouseId: "",
                warehouseRegionId: "",
              },
            ],
            orderNumber: "",
            orderPaymentExecutions: [
              {
                applyPaymentAmount: "",
                changeTime: "",
                createTime: "",
                id: "",

                orderId: "",
                paymentAmount: "",
                relationDocument: "",
                relationDocumentCode: "",
                returnAmount: "",
                userId: "",
              },
            ],
            orderPaymentPlans: [
              {
                actualPrepaidAmount: "",
                changeTime: "",
                createTime: "",
                id: "",
                isPrepaid: true,

                orderId: "",
                payableMoney: "",
                payableRate: "",
                payableTime: "",
                paymentRelatedAmount: "",
                prepaidCode: "",
                remark: "",
                singlePrepaidLimit: "",
                supplierId: "",
                userId: "",
              },
            ],
            orderPurchaseTerms: [
              {
                changeTime: "",
                createTime: "",
                descInfo: "",
                id: "",

                orderId: "",
                purchaseTerms: {
                  changeTime: "",
                  code: "",
                  createTime: "",
                  describe: "",
                  id: "",

                  name: "",
                  state: "",
                  termsContent: "",
                  termsType: "",
                  userId: "",
                },
                purchaseTermsId: "",
                type: "",
                userId: "",
              },
            ],
            orderSupplier: {
              balanceId: "",
              changeTime: "",
              createTime: "",
              email: "",
              id: "",

              orderId: "",
              phone: "",
              post: "",
              providerAddress: "",
              providerContacts: "",
              providerId: "",
              receiveId: "",
              userId: "",
            },
            originalOrderCode: "",
            page: 0,
            parentId: "",
            priceInfoId: "",
            pricingTimePoint: "",
            projectId: "",
            projectName: "",
            purchaseDept: "",
            purchaseGroup: "",
            purchaseOrg: "",
            settlementCurrency: "",
            settlementMethod: "",
            sourceDocType: "",
            state: "",
            status: 0,
            supplierId: "",
            supplierName: "",
            taxAmount: "",
            taxAmountBase: "",
            termOfPayment: "",
            token: "",
            totalPaymentAmount: "",
            totalPaymentApplyAmount: "",
            totalPriceTax: "",
            totalPriceTaxBase: "",
            totalReturnAmount: "",
            totalUnpaidAmount: "",
            updateName: "",
            updateState: "",
            updateTime: "",
            userId: "",
            version: "",
            wholeDiscountAmount: "",
          };
          this.formData.orderEntities.push(obj);
        },
        storage: () => {
          let obj = {
            balanceCode: "",
            balanceId: "",
            baseCurrency: "",
            cargoOwner: "",
            cargoOwnerType: "",
            childTye: "",
            confirmName: "",
            confirmState: "",
            confirmTime: "",
            createName: "",
            createTime: "",
            discountInfoCode: "",
            docBusinessType: "",
            docCode: "",
            docStatus: "",
            docType: "",
            email: "",
            examineName: "",
            examineTime: "",
            exchangeRate: "",
            exchangeRateType: "",
            id: "",
            invalidName: "",
            invalidState: "",
            invalidTime: "",
            inventoryGroup: "",
            inventoryTime: "",
            isExtraPriceTax: true,
            isTax: true,

            lastUpdateName: "",
            lastUpdateTime: "",
            managementBy: "",
            materialLists: [
              {
                batchNum: "",
                changeTime: "",
                createTime: "",
                currentReconciliationCode: "",
                defectiveDiscountAmount: "",
                historyReconciliationCode: "",
                id: "",
                inventoryId: "",
                inventoryStatus: "",
                inventoryType: "",
                inventoryUnit: "",
                isGiveaway: true,
                isReconciliation: true,

                materialCode: "",
                materialDesc: "",
                materialDetail: {
                  amountMoney: "",
                  amountMoneyBase: "",
                  auxiliaryUnit: "",
                  batchNum: "",
                  bomVer: "",
                  businessProcess: "",
                  changeTime: "",
                  containsTaxPrice: "",
                  createTime: "",
                  discountAmount: "",
                  discountRate: "",
                  entryPriceList: "",
                  id: "",
                  inventoryId: "",
                  inventoryMaterialId: "",

                  manufactureTime: "",
                  materialCode: "",
                  materialDetailSerials: [
                    {
                      changeTime: "",
                      createTime: "",
                      id: "",
                      inventoryId: "",
                      inventoryMaterialId: "",

                      materialDetailId: "",
                      remark: "",
                      serialCode: "",
                      userId: "",
                    },
                  ],
                  materialId: "",
                  materialModel: "",
                  materialName: "",
                  netAmount: "",
                  orderCode: "",
                  payableCloseStatus: "",
                  payableCloseTime: "",
                  planTrackingCode: "",
                  price: "",
                  priceCap: "",
                  priceCoefficient: "",
                  priceDiscount: "",
                  priceFloor: "",
                  pricingNum: "",
                  pricingUnit: "",
                  receivedNum: "",
                  remark: "",
                  requireTrackingCode: "",
                  returnRelatedNum: "",
                  sampleDestructionNum: "",
                  serialCodeUnit: "",
                  serialCodeUnitNum: "",
                  serialCodeUpload: "",
                  shelfLifeCycle: "",
                  sourceDocCode: "",
                  sourceDocType: "",
                  supplierBatchNum: "",
                  taxAmount: "",
                  taxAmountBase: "",
                  taxRate: "",
                  totalTaxPrice: "",
                  totalTaxPriceBase: "",
                  userId: "",
                  validTo: "",
                  warrantyTime: "",
                  warrantyUnit: "",
                },
                materialId: "",
                materialModel: "",
                materialName: "",
                moneyAmount: "",
                netPrice: "",
                pricingNum: "",
                pricingUnit: "",
                purchaseNum: 0,
                purchaseUnit: "",
                receiptsNum: 0,
                receivableNum: 0,
                relationId: "",
                remark: "",
                userId: "",
                warehouseCode: "",
                warehouseId: "",
                warehousePosition: "",
              },
            ],
            moneyAmount: "",
            priceInfoCode: "",
            pricingTimePoint: "",
            providerAddress: "",
            providerCode: "",
            providerContacts: "",
            providerId: "",
            purchaseBy: "",
            purchaseDept: "",
            purchaseGroup: "",
            purchaseOrg: "",
            receiveCode: "",
            receiveId: "",
            receivingDept: "",
            receivingOrg: "",
            requireDept: "",
            settlementCurrency: "",
            settlementMethod: "",
            settlementOrg: "",
            supplierCode: "",
            supplierId: "",
            taxAmount: "",
            termOfPayment: "",
            totalPriceTax: "",
            type: "",
            userId: "",
          };
          this.formData.kingInventoryEntities.push(obj);
        },
        refund: () => {
          let obj = {
            balanceCode: "",
            balanceId: "",
            baseCurrency: "",
            cargoCustomer: "",
            cargoOwner: "",
            cargoOwnerType: "",
            checkMethod: "",
            confirmName: "",
            confirmState: "",
            confirmTime: "",
            createName: "",
            createTime: "",
            discountInfoCode: "",
            docBusinessType: "",
            docCode: "",
            docStatus: "",
            docType: "",
            email: "",
            examineName: "",
            examineTime: "",
            exchangeRate: "",
            exchangeRateType: "",
            id: "",
            inventoryGroup: "",
            isExtraPriceTax: "",
            isTax: "",

            lastUpdateName: "",
            lastUpdateTime: "",
            managementBy: "",
            materialLists: [
              {
                amountMoney: "",
                amountMoneyBase: "",
                auxiliaryUnit: "",
                auxiliaryUnitNum: "",
                baseUnit: "",
                baseUnitPrice: "",
                batchNum: "",
                cargoOwner: "",
                cargoOwnerType: "",
                containsTaxPrice: "",
                costPrice: "",
                costPriceBase: "",
                createBy: "",
                createTime: "",
                deductionNum: "",
                discountAmount: "",
                discountRate: "",
                fixedPricingUnit: "",
                id: "",
                inventoryNumBase: "",
                inventoryStatus: "",
                inventoryUnit: "",
                invoicingCompletedStatus: "",
                isGiveaway: "",

                keepingBy: "",
                materialCode: "",
                materialDetail: {
                  amountMoney: "",
                  amountMoneyBase: "",
                  auxiliaryUnit: "",
                  batchNum: "",
                  bomVer: "",
                  businessProcess: "",
                  containsTaxPrice: "",
                  createBy: "",
                  createTime: "",
                  discountAmount: "",
                  discountRate: "",
                  entryPriceList: "",
                  feeInfoCode: "",
                  id: "",
                  invoicedNum: "",
                  invoicingCompletedStatus: "",

                  manufactureTime: "",
                  materialCode: "",
                  materialDetailSerials: [
                    {
                      createBy: "",
                      createTime: "",
                      id: "",

                      materialDetailId: "",
                      procureRefundId: "",
                      procureRefundMaterialId: "",
                      remark: "",
                      serialCode: "",
                      updateBy: "",
                      updateTime: "",
                    },
                  ],
                  materialId: "",
                  materialModel: "",
                  materialName: "",
                  netAmount: "",
                  orderCode: "",
                  payableCloseStatus: "",
                  payableCloseTime: "",
                  planTrackingCode: "",
                  price: "",
                  priceCap: "",
                  priceCoefficient: "",
                  priceDiscount: "",
                  priceFloor: "",
                  pricingNum: "",
                  pricingUnit: "",
                  procureRefundId: "",
                  procureRefundMaterialId: "",
                  refundNum: "",
                  requireTrackingCode: "",
                  serialCodeUnit: "",
                  serialCodeUnitNum: "",
                  serialCodeUpload: "",
                  shelfLifeCycle: "",
                  sourceDocCode: "",
                  sourceDocType: "",
                  supplierBatchNum: "",
                  systemPricing: "",
                  taxAmount: "",
                  taxAmountBase: "",
                  taxRate: "",
                  totalTaxPrice: "",
                  totalTaxPriceBase: "",
                  updateBy: "",
                  updateTime: "",
                  validTo: "",
                  warrantyTime: "",
                  warrantyUnit: "",
                },
                materialId: "",
                materialModel: "",
                materialName: "",
                netAmount: "",
                price: "",
                priceDiscount: "",
                pricingNum: "",
                pricingNumBase: "",
                pricingUnit: "",
                projectCode: "",
                projectId: "",
                purchaseNum: "",
                purchaseNumBase: "",
                purchaseUnit: "",
                refundNum: "",
                refundNumAuxiliary: "",
                refundedNum: "",
                relationId: "",
                remark: "",
                repairNum: "",
                sourceInventoryCode: "",
                sourceInventoryId: "",
                sourceOrderCode: "",
                sourceOrderId: "",
                sourceType: "",
                supplierBatchNum: "",
                supplierMaterialCode: "",
                supplierMaterialName: "",
                taxAmount: "",
                taxAmountBase: "",
                taxRate: "",
                totalCost: "",
                totalCostBase: "",
                totalTaxPrice: "",
                totalTaxPriceBase: "",
                type: 0,
                updateBy: "",
                updateTime: "",
                warehouseCode: "",
                warehouseId: "",
                warehousePosition: "",
              },
            ],
            moneyAmount: "",
            moneyAmountBase: "",
            priceInfoCode: "",
            pricingTimePoint: "",
            providerAddress: "",
            providerCode: "",
            providerContacts: "",
            providerId: "",
            purchaseBy: "",
            purchaseDept: "",
            purchaseGroup: "",
            purchaseOrg: "",
            receiveCode: "",
            receiveId: "",
            refundDept: "",
            refundMethod: "",
            refundOrg: "",
            refundReason: "",
            refundTime: "",
            refundType: "",
            requireOrg: "",
            settlementCurrency: "",
            settlementMethod: "",
            settlementOrg: "",
            supplementMethod: "",
            supplierCode: "",
            supplierId: "",
            taxAmount: "",
            taxAmountBase: "",
            termOfPayment: "",
            totalCost: "",
            totalCostBase: "",
            totalPriceTax: "",
            totalPriceTaxBase: "",
            type: 0,
            updateBy: "",
            updateTime: "",
          };
          this.formData.kingProcureRefundEntities.push(obj);
        },
      };
      nameMap[type] ? nameMap[type]() : "";
    },
    // 新增列表行
    handleDataAdd(index, row, type) {
      this.addNewRow(type);
    },
    // 删除列表行
    handleDataDelete(index, row, type) {
      this.$confirm("此操作将删除该记录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          const nameMap = {
            detail: () => {
              this.formData.kingInvoicePayableDetailEntities.splice(index, 1);
            },
            plan: () => {
              this.formData.kingInvoicePayableProcurePlanEntities.splice(
                index,
                1
              );
            },
            order: () => {
              this.formData.orderEntities.splice(index, 1);
            },
            storage: () => {
              this.formData.kingInventoryEntities.splice(index, 1);
            },
            refund: () => {
              this.formData.kingProcureRefundEntities.splice(index, 1);
            },
          };
          nameMap[type] ? nameMap[type]() : "";
          this.$message({
            type: "success",
            message: "删除成功!",
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    // 打开弹窗
    showDialog(type, index) {
      this.open = true;
      this.dialogType = type;
      this.selectItem = [];
      this.currentIndex = index;
      const nameMap = {
        supplier: () => {
          this.currentCom = Supplier;
          this.dialogTitle = "选择供应商";
        },
        payTerms: () => {
          this.currentCom = PayTerms;
          this.dialogTitle = "选择付款条件";
        },
        customer: () => {
          this.currentCom = Customer;
          this.dialogTitle = "选择客户";
        },
        currency: () => {
          this.currentCom = Currency;
          this.dialogTitle = "选择币别";
        },

        dept: () => {
          this.currentCom = Dept;
          this.dialogTitle = "选择采购部门";
        },
        user: () => {
          this.currentCom = SaleUser;
          this.dialogTitle = "选择采购员";
        },
        materialCode: () => {
          this.dialogTitle = "选择物料";
          this.currentCom = Material;
        },
        rate: () => {
          this.dialogTitle = "选择税率";
          this.currentCom = TaxRate;
        },
        unit: () => {
          this.dialogTitle = "选择计价单位";
          this.currentCom = Unit;
        },
        fee: () => {
          this.dialogTitle = "选择费用项目";
          this.currentCom = Fee;
        },
        feeDept: () => {
          this.dialogTitle = "选择部门";
          this.currentCom = FeeDept;
        },
      };
      nameMap[type] ? nameMap[type]() : "";
    },
    // 弹窗关闭事件
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
          this.selectItem = [];
        })
        .catch((_) => {});
    },
    // 弹窗取消按钮
    cancelSelect() {
      this.open = false;
      this.selectItem = [];
    },
    // 弹窗选择
    getSelectVal(val) {
      this.selectItem = val;
      console.log("val", val);
    },
    // 弹窗确认
    confirmSelect() {
      const nameMap = {
        supplier: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.formData.kingInvoicePayableEntity.supplierId =
            this.selectItem[0].id;
          this.formData.kingInvoicePayableEntity.supplierCode =
            this.selectItem[0].supplierCode;
          this.formData.kingInvoicePayableEntity.supplierName =
            this.selectItem[0].supplierName;
          this.open = false;
        },
        payTerms: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.formData.kingInvoicePayableEntity.payTermsId =
            this.selectItem[0].id;
        },
        customer: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.formData.kingInvoicePayableEntity.customerName =
            this.selectItem[0].customerName;
          this.formData.kingInvoicePayableEntity.customerId =
            this.selectItem[0].id;
          this.open = false;
        },
        currency: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.formData.kingInvoicePayableEntity.currencyName =
            this.selectItem[0].currencyName;
          this.formData.kingInvoicePayableEntity.currencyId =
            this.selectItem[0].id;
          this.formData.kingInvoicePayableEntity.currencyCode =
            this.selectItem[0].currencyCode;
          this.open = false;
        },
        receipt: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.formData.kingInvoicePayableEntity.receiptConditionId =
            this.selectItem[0].id;
          this.open = false;
        },
        dept: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.formData.kingInvoicePayableEntity.procureDeptId =
            this.selectItem[0].deptId;
          this.formData.kingInvoicePayableEntity.procureDeptCode =
            this.selectItem[0].deptCode;
          this.formData.kingInvoicePayableEntity.procureDeptName =
            this.selectItem[0].deptName;
          this.open = false;
        },
        user: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.formData.kingInvoicePayableEntity.procureUserId =
            this.selectItem[0].userId;
          this.formData.kingInvoicePayableEntity.procureUser =
            this.selectItem[0].userName;
          this.open = false;
        },
        materialCode: () => {
          this.handleListBack(
            this.formData.kingInvoicePayableDetailEntities,
            "detail",
            true
          );
          this.open = false;
        },
        unit: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          console.log("this.selectItem", this.selectItem);
          this.$set(
            this.formData.kingInvoicePayableDetailEntities[this.currentIndex],
            "unit",
            this.selectItem[0].meteringUnitCode
          );
          this.open = false;
        },
        rate: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.$set(
            this.formData.kingInvoicePayableDetailEntities[this.currentIndex],
            "rate",
            this.selectItem[0].rateCode
          );
          this.open = false;
        },
        fee: () => {
          this.handleListBack(
            this.formData.kingInvoicePayableDetailEntities,
            "detail",
            false
          );
          console.log("this.selectItem", this.selectItem);
          this.open = false;
        },
        feeDept: () => {
          if (this.selectItem.length !== 1) {
            this.$message.error("请选择一条记录！");
            return;
          }
          this.$set(
            this.formData.kingInvoicePayableDetailEntities[this.currentIndex],
            "feeBearDeptId",
            this.selectItem[0].deptId
          );
          this.open = false;
        },
      };
      nameMap[this.dialogType] ? nameMap[this.dialogType]() : "";
    },
    // 处理列表弹窗回显
    handleListBack(arr, type, isAllKey) {
      let obj = null;

      arr.splice(this.currentIndex, 1);
      if (isAllKey) {
        this.selectItem.forEach((item) => {
          const nameMap = {
            detail: () => {
              obj = {
                createBy: "",
                createTime: "",
                discountAmount: "",
                discountRate: "",
                feeBearDeptId: "",
                feeCode: "",
                feeId: "",
                id: "",
                inOutStorageId: "",
                invoiceReceivableId: "",

                materialCode: "",
                materialId: "",
                materialName: "",
                notTaxAmount: "",
                num: "",
                pageNo: 0,
                pageSize: 0,
                params: {},
                price: "",
                rate: "",
                rateAmount: "",
                remark: "",
                saleOrderId: "",
                searchValue: "",
                sourceDocId: "",
                sourceDocType: 0,
                taxPrice: "",
                unit: "",
                updateBy: "",
                updateTime: "",
              };
            },
            plan: () => {
              obj = {
                createBy: "",
                createTime: "",
                dueTime: "",
                id: "",
                invoiceReceivableId: "",

                pageNo: 0,
                pageSize: 0,
                params: {},
                receiptAmount: "",
                receiptRatio: "",
                remark: "",
                remarks: "",
                saleOrderId: "",
                searchValue: "",
                updateBy: "",
                updateTime: "",
              };
            },
            order: () => {
              obj = {
                businessType: "",
                changeReason: "",
                createBy: "",
                createTime: "",
                currency: "",
                customerId: "",
                customerName: "",
                delFlag: "",
                deliveryAddress: "",
                deliveryMethod: "",
                deptId: "",
                discountInfoId: "",
                id: "",
                instanceId: "",
                isTax: "",
                kingDocCode: "",
                kingDocTypeId: "",
                level: 0,
                margin: "",
                marginLevel: "",
                materialDetailList: [
                  {
                    amountMoney: "",
                    batchNum: "",
                    businessTaxCostPrice: "",
                    changeTime: "",
                    changeType: "",
                    createTime: "",
                    deliveryAddress: "",
                    deliveryDate: "",
                    deliveryLocation: "",
                    discountAmount: "",
                    discountRate: "",
                    executeStatus: "",
                    id: "",
                    inventoryId: "",
                    inventoryNum: 0,
                    inventoryUnit: "",
                    isGiveaway: true,

                    limit: 0,
                    material: {
                      allowAsset: "",
                      allowInventory: "",
                      allowOutsource: "",
                      allowProduce: "",
                      allowPurchase: "",
                      allowSale: "",
                      barCode: "",
                      brand: "",
                      businessType: "",
                      configurationProduction: "",
                      costPriceRatio: "",
                      createBy: "",
                      createTime: "",
                      dataState: "",
                      defaultTaxRate: "",
                      deptId: "",
                      disableBy: "",
                      examineBy: "",
                      examineTime: "",
                      grossWeight: "",
                      heightStr: "",
                      id: "",
                      imgUrl: "",
                      instanceId: "",
                      inventoryType: "",
                      isChange: "",

                      kit: "",
                      lengthStr: "",
                      materialCode: "",
                      materialDesc: "",
                      materialGroup: "",
                      materialInventoryEntity: {
                        batchInfo: "",
                        batchRule: "",
                        checkCycle: "",
                        convertDirection: "",
                        costUnit: "",
                        createBy: "",
                        createTime: "",
                        currency: "",
                        day: "",
                        economicOrderingBatch: "",
                        id: "",
                        inventoryUnit: "",
                        isBatch: "",
                        isCheck: "",
                        isLock: "",
                        isMaxInventory: "",
                        isMinInventory: "",
                        isOrderGoods: "",
                        isSafeInventory: "",
                        isTrueCheck: "",
                        materialId: "",
                        maxInventoyNum: "",
                        minInventoryNum: "",
                        orderGoodsNum: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        qualityManage: "",
                        qualityNum: "",
                        qualityUnit: "",
                        referenceCost: "",
                        remark: "",
                        safeInventoryNum: "",
                        searchValue: "",
                        serviceLife: "",
                        standardNumber: "",
                        supportUnit: "",
                        updateBy: "",
                        updateTime: "",
                        warePosition: "",
                        warehouseCode: "",
                      },
                      materialName: "",
                      materialPlanAttributeEntity: {
                        createBy: "",
                        createTime: "",
                        fAllowPartDelay: "",
                        fBaseVarLeadTimeLotSize: "",
                        fBaseVarLeadTimeLotSizeUnit: "",
                        fCanDelayDays: 0,
                        fCanLeadDays: 0,
                        fCheckLeadTime: 0,
                        fCheckLeadTimeType: "",
                        fDelayExtendDay: 0,
                        fFixLeadTime: 0,
                        fFixLeadTimeType: "",
                        fIncreaseQty: 0,
                        fIncreaseQtyUnit: "",
                        fIsMrpComBill: "",
                        fIsMrpComReq: "",
                        fLeadExtendDay: 0,
                        fMaxPoqty: 0,
                        fMfgPolicyId: "",
                        fMinPoqty: 0,
                        fMinPoqtyUnit: "",
                        fOrderIntervalTime: 0,
                        fOrderIntervalTimeType: "",
                        fOrderPolicy: "",
                        fPlanBatchSplitQty: "",
                        fPlanBatchSplitQtyUnit: "",
                        fPlanGroupId: "",
                        fPlanIdent: "",
                        fPlanIntervalsDays: 0,
                        fPlanOffsetTime: 0,
                        fPlanOffsetTimeType: "",
                        fPlanSafeStockQty: 0,
                        fPlanSafeStockQtyUnit: "",
                        fPlanTimeZone: 0,
                        fPlanWorkshop: "",
                        fPlanerId: "",
                        fPlanningStrategy: "",
                        fProScheTrackId: "",
                        fProductLine: "",
                        fRequestTimeZone: 0,
                        fSupplySourceId: "",
                        fVarLeadTime: 0,
                        fVarLeadTimeLotSize: "",
                        fVarLeadTimeLotSizeUnit: "",
                        fVarLeadTimeType: "",
                        fWriteOffQty: "",
                        fWriteOffQtyUnit: "",
                        id: "",
                        materialId: "",
                        maxPoqtyUnit: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        remark: "",
                        searchValue: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      materialProcureEntity: {
                        agentProcure: "",
                        barCodeRule: "",
                        createBy: "",
                        createTime: "",
                        dayProduction: 0,
                        dayProductionUnit: "",
                        defaultSupplier: "",
                        defunctProductionLine: "",
                        expenseItem: "",
                        id: "",
                        isControl: "",
                        isDayProduction: "",
                        isMaterialReturn: "",
                        isQuota: "",
                        isReq: "",
                        materialId: "",
                        minPackNum: "",
                        minSpiltNum: 0,
                        outsourcePricingUnit: "",
                        outsourceType: "",
                        outsourceUnit: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        procureGroup: "",
                        procureId: "",
                        procurePricingUnit: "",
                        procureType: "",
                        procureUnit: "",
                        quotaMode: "",
                        remark: "",
                        repeatPutNum: "",
                        searchValue: "",
                        takeOverDelay: 0,
                        takeOverDown: "",
                        takeOverLead: 0,
                        takeOverUp: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      materialProductEntity: {
                        createBy: "",
                        createTime: "",
                        deptId: "",
                        fBackFlushType: "",
                        fConsumVolatility: "",
                        fDefaultLineId: "",
                        fDefaultRouting: "",
                        fFinishReceiptOverRate: "",
                        fFinishReceiptShortRate: "",
                        fIsCompleteSet: "",
                        fIsEnableSchedule: "",
                        fIsKitting: "",
                        fIsMainPrd: "",
                        fIsMinissueQty: "",
                        fIsProductLine: "",
                        fIsSNCarryToParent: "",
                        fIssueType: "",
                        fMdlId: "",
                        fMdlMaterialId: "",
                        fMinissueQty: 0,
                        fMinissueUnitId: "",
                        fOrgTrustBillType: "",
                        fOverControlMode: "",
                        fPerUnitStandHour: "",
                        fPickBinId: "",
                        fPickStockId: "",
                        fProduceBillType: "",
                        fProduceUnitId: "",
                        fStandHourUnitId: "",
                        fStdLaborPrePareTime: "",
                        fStdLaborProcessTime: "",
                        fStdMachinePrepareTime: "",
                        fStdMachineProcessTime: "",
                        fWorkShopId: "",
                        fbkfltime: "",
                        fbomunitid: "",
                        ffixloss: "",
                        fisecn: "",
                        flosspercent: "",
                        id: "",
                        materialId: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        remark: "",
                        searchValue: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      materialProperty: "",
                      materialQualityEntity: {
                        createBy: "",
                        createTime: "",
                        fCheckDelivery: "",
                        fCheckEntrusted: "",
                        fCheckIncoming: "",
                        fCheckOther: "",
                        fCheckProduct: "",
                        fCheckReturn: "",
                        fCheckStock: "",
                        fCheckSubFtnMtrl: "",
                        fEWLeadDay: "",
                        fEnableCyclistQCSTK: "",
                        fEnableCyclistQcstkew: "",
                        fFirstQCControlType: "",
                        fIncQcSchemeId: "",
                        fIncSampSchemeId: "",
                        fInspectGroupId: "",
                        fInspectorId: "",
                        fIsFirstInspect: "",
                        fStockCycle: "",
                        id: "",
                        materialId: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        remark: "",
                        searchValue: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      materialSaleEntity: {
                        allowReleaseOrder: "",
                        allowReturns: "",
                        atpCheck: "",
                        controlSurpassUnit: "",
                        createBy: "",
                        createTime: "",
                        dropOutCount: "",
                        fisReturnPart: "",
                        fisaftersale: "",
                        fisproductfiles: "",
                        fiswarranted: "",
                        fwarranty: "",
                        fwarrantyunitid: "",
                        id: "",
                        isFavourableTax: "",
                        materialId: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        remark: "",
                        saleDownPrice: "",
                        saleGroup: "",
                        saleOutbound: "",
                        salePricingUnit: "",
                        saleUnit: "",
                        searchValue: "",
                        startOrderNum: 0,
                        surpassDown: "",
                        surpassUp: "",
                        taxType: "",
                        taxTypeCode: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      mnemonicCode: "",
                      model: "",
                      modelId: "",
                      netWeight: "",
                      oldMaterialCode: "",
                      pageNo: 0,
                      pageSize: 0,
                      params: {},
                      reasonForDisable: "",
                      remark: "",
                      searchValue: "",
                      sizeUnit: "",
                      state: "",
                      subItems: "",
                      taxType: "",
                      typeName: "",
                      unit: "",
                      updateBy: "",
                      updateTime: "",
                      volume: "",
                      weightUnit: "",
                      wideStr: "",
                    },
                    materialChangeEntity: {},
                    materialCode: "",
                    materialId: "",
                    netAmount: "",
                    noTaxMoney: "",
                    number: 0,
                    orderDelivery: {
                      batchNum: "",
                      bomVer: "",
                      changeTime: "",
                      controlDeliveryNum: true,
                      controlDeliveryTime: true,
                      createTime: "",
                      deliveryDelayDay: "",
                      deliveryDown: "",
                      deliveryEarlyTime: "",
                      deliveryLatestTime: "",
                      deliveryLeadDay: "",
                      deliveryUp: "",
                      id: "",

                      materialId: "",
                      materialName: "",
                      orderDeliveryDetails: [
                        {
                          address: "",
                          changeTime: "",
                          confirmComment: "",
                          confirmNum: "",
                          confirmTime: "",
                          createTime: "",
                          deliveredNum: "",
                          deliveryTime: "",
                          id: "",

                          location: "",
                          num: "",
                          orderDeliveryId: "",
                          orderId: "",
                          planUnit: "",
                          surplusNum: "",
                          userId: "",
                        },
                      ],
                      orderId: "",
                      receiveDept: "",
                      receiveOrg: "",
                      requireDept: "",
                      requireOrg: "",
                      supplierBatch: "",
                      supportAttr: "",
                      userId: "",
                    },
                    orderFinanceDetail: {
                      changeTime: "",
                      createTime: "",
                      discountAmount: "",
                      discountRate: "",
                      entryPriceInfo: "",
                      id: "",

                      materialCode: "",
                      materialId: "",
                      materialName: "",
                      netPrice: "",
                      orderId: "",
                      priceCeiling: "",
                      priceCoefficient: "",
                      priceFloor: "",
                      pricingNum: "",
                      pricingUnit: "",
                      settlementDept: "",
                      systemPricing: "",
                      taxRate: "",
                      unitPriceDiscount: "",
                      userId: "",
                    },
                    orderOther: {
                      businessClose: "",
                      businessFreeze: "",
                      businessProcess: "",
                      businessStop: "",
                      changeTime: "",
                      contractsCode: "",
                      createTime: "",
                      freezeName: "",
                      freezeTime: "",
                      id: "",
                      inventoryReturnNum: "",
                      isPlanConfirm: "",
                      isQuotaGeneration: "",

                      materialCode: "",
                      materialId: "",
                      materialName: "",
                      materialReceivedReturnNum: "",
                      orderId: "",
                      planTrackingCode: "",
                      requireDocCode: "",
                      requireDocLineCode: "",
                      requireFrom: "",
                      requireTrackingCode: "",
                      sourceDocCode: "",
                      sourceDocType: "",
                      stopName: "",
                      stopTime: "",
                      surplusInboundNum: "",
                      surplusMaterialReceivedNum: "",
                      totalInboundNum: "",
                      totalMaterialReceivedNum: "",
                      totalMaterialReturnNum: "",
                      updateFlag: "",
                      userId: "",
                    },
                    originalContainsTaxPrice: "",
                    originalNumber: "",
                    page: 0,
                    parentMaterial: "",
                    price: "",
                    pricingNum: "",
                    pricingUnit: "",
                    purchaseUnit: "",
                    ramarks: "",
                    receivedFirstTicketsNum: "",
                    receivingDept: "",
                    relationId: "",
                    requireDept: "",
                    saleOrderDelivery: {
                      createBy: "",
                      createTime: "",
                      deliveryDown: "",
                      deliveryType: "",
                      deliveryUnit: "",
                      deliveryUp: "",
                      id: "",
                      inventoryDept: "",

                      materialCode: "",
                      materialName: "",
                      orderId: "",
                      pageNo: 0,
                      pageSize: 0,
                      params: {},
                      remark: "",
                      saleOrderDeliveryDetailEntities: [
                        {
                          createBy: "",
                          createTime: "",
                          deliveryAddress: "",
                          deliveryAddressDetail: "",
                          deliveryDate: "",
                          deliveryId: "",
                          id: "",
                          inAdvance: "",

                          pageNo: 0,
                          pageSize: 0,
                          params: {},
                          planDeliveryDate: "",
                          remark: "",
                          saleNum: "",
                          saleUnit: "",
                          searchValue: "",
                          updateBy: "",
                          updateTime: "",
                        },
                      ],
                      searchValue: "",
                      updateBy: "",
                      updateTime: "",
                    },
                    settlementDept: "",
                    sourceDocCode: "",
                    sourceDocType: "",
                    sourceRelationId: "",
                    supplierMaterialCode: "",
                    supplierMaterialName: "",
                    taxAmount: "",
                    taxMoney: "",
                    taxPrice: "",
                    taxRate: "",
                    token: "",
                    totalAcceptanceAmount: "",
                    totalAcceptanceRate: "",
                    totalTaxPrice: "",
                    type: 0,
                    warehouseId: "",
                    warehouseRegionId: "",
                  },
                ],
                modelId: "",
                originalOrderCode: "",
                pageNo: 0,
                pageSize: 0,
                params: {},
                parentId: "",
                payer: "",
                paymentTerms: "",
                priceTax: "",
                priceinfoId: "",
                rate: "",
                rateType: "",
                receivingParty: "",
                remark: "",
                saleCode: "",
                saleDate: "",
                saleDept: "",
                saleGroup: "",
                saleId: "",
                searchValue: "",
                settlementParty: "",
                settlementType: "",
                shippingAddress: "",
                shippingPerson: "",
                shippingPersonName: "",
                shippingPhone: "",
                sourceDocType: "",
                sourceDocTypeName: "",
                state: "",
                taxAmount: "",
                updateBy: "",
                updateState: "",
                updateTime: "",
                valueTax: "",
              };
            },
            storage: () => {
              obj = {
                batchNumber: "",
                changeTime: "",
                contractId: "",
                createTime: "",
                id: "",
                inOutTime: "",
                inStorageType: 0,
                instanceId: 0,

                limit: 0,
                orderId: "",
                page: 0,
                projectId: "",
                purchaseCode: "",
                remarks: "",
                state: 0,
                supplierId: "",
                token: "",
                type: 0,
                useUserId: "",
                warehouseId: "",
                warehouseRegionId: "",
              };
            },
          };
          nameMap[type] ? nameMap[type]() : "";
          Object.keys(item).forEach((itemKey) => {
            Object.keys(obj).forEach((materialKey) => {
              if (itemKey === materialKey) {
                obj[materialKey] = item[itemKey];
              }
            });
          });
          arr.push(obj);
        });
      } else {
        this.selectItem.forEach((item) => {
          const nameMap = {
            detail: () => {
              obj = {
                createBy: "",
                createTime: "",
                discountAmount: "",
                discountRate: "",
                feeBearDeptId: "",
                feeCode: "",
                feeId: "",
                id: "",
                inOutStorageId: "",
                invoiceReceivableId: "",

                materialCode: "",
                materialId: "",
                materialName: "",
                notTaxAmount: "",
                num: "",
                pageNo: 0,
                pageSize: 0,
                params: {},
                price: "",
                rate: "",
                rateAmount: "",
                remark: "",
                saleOrderId: "",
                searchValue: "",
                sourceDocId: "",
                sourceDocType: 0,
                taxPrice: "",
                unit: "",
                updateBy: "",
                updateTime: "",
              };
              item.id ? (obj.feeId = item.id) : ""; //费用项目名称
              item.feeCode ? (obj.feeCode = item.feeCode) : ""; //费用项目编码
            },
            plan: () => {
              obj = {
                createBy: "",
                createTime: "",
                dueTime: "",
                id: "",
                invoiceReceivableId: "",

                pageNo: 0,
                pageSize: 0,
                params: {},
                receiptAmount: "",
                receiptRatio: "",
                remark: "",
                remarks: "",
                saleOrderId: "",
                searchValue: "",
                updateBy: "",
                updateTime: "",
              };
            },
            order: () => {
              obj = {
                businessType: "",
                changeReason: "",
                createBy: "",
                createTime: "",
                currency: "",
                customerId: "",
                customerName: "",
                delFlag: "",
                deliveryAddress: "",
                deliveryMethod: "",
                deptId: "",
                discountInfoId: "",
                id: "",
                instanceId: "",
                isTax: "",
                kingDocCode: "",
                kingDocTypeId: "",
                level: 0,
                margin: "",
                marginLevel: "",
                materialDetailList: [
                  {
                    amountMoney: "",
                    batchNum: "",
                    businessTaxCostPrice: "",
                    changeTime: "",
                    changeType: "",
                    createTime: "",
                    deliveryAddress: "",
                    deliveryDate: "",
                    deliveryLocation: "",
                    discountAmount: "",
                    discountRate: "",
                    executeStatus: "",
                    id: "",
                    inventoryId: "",
                    inventoryNum: 0,
                    inventoryUnit: "",
                    isGiveaway: true,

                    limit: 0,
                    material: {
                      allowAsset: "",
                      allowInventory: "",
                      allowOutsource: "",
                      allowProduce: "",
                      allowPurchase: "",
                      allowSale: "",
                      barCode: "",
                      brand: "",
                      businessType: "",
                      configurationProduction: "",
                      costPriceRatio: "",
                      createBy: "",
                      createTime: "",
                      dataState: "",
                      defaultTaxRate: "",
                      deptId: "",
                      disableBy: "",
                      examineBy: "",
                      examineTime: "",
                      grossWeight: "",
                      heightStr: "",
                      id: "",
                      imgUrl: "",
                      instanceId: "",
                      inventoryType: "",
                      isChange: "",

                      kit: "",
                      lengthStr: "",
                      materialCode: "",
                      materialDesc: "",
                      materialGroup: "",
                      materialInventoryEntity: {
                        batchInfo: "",
                        batchRule: "",
                        checkCycle: "",
                        convertDirection: "",
                        costUnit: "",
                        createBy: "",
                        createTime: "",
                        currency: "",
                        day: "",
                        economicOrderingBatch: "",
                        id: "",
                        inventoryUnit: "",
                        isBatch: "",
                        isCheck: "",
                        isLock: "",
                        isMaxInventory: "",
                        isMinInventory: "",
                        isOrderGoods: "",
                        isSafeInventory: "",
                        isTrueCheck: "",
                        materialId: "",
                        maxInventoyNum: "",
                        minInventoryNum: "",
                        orderGoodsNum: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        qualityManage: "",
                        qualityNum: "",
                        qualityUnit: "",
                        referenceCost: "",
                        remark: "",
                        safeInventoryNum: "",
                        searchValue: "",
                        serviceLife: "",
                        standardNumber: "",
                        supportUnit: "",
                        updateBy: "",
                        updateTime: "",
                        warePosition: "",
                        warehouseCode: "",
                      },
                      materialName: "",
                      materialPlanAttributeEntity: {
                        createBy: "",
                        createTime: "",
                        fAllowPartDelay: "",
                        fBaseVarLeadTimeLotSize: "",
                        fBaseVarLeadTimeLotSizeUnit: "",
                        fCanDelayDays: 0,
                        fCanLeadDays: 0,
                        fCheckLeadTime: 0,
                        fCheckLeadTimeType: "",
                        fDelayExtendDay: 0,
                        fFixLeadTime: 0,
                        fFixLeadTimeType: "",
                        fIncreaseQty: 0,
                        fIncreaseQtyUnit: "",
                        fIsMrpComBill: "",
                        fIsMrpComReq: "",
                        fLeadExtendDay: 0,
                        fMaxPoqty: 0,
                        fMfgPolicyId: "",
                        fMinPoqty: 0,
                        fMinPoqtyUnit: "",
                        fOrderIntervalTime: 0,
                        fOrderIntervalTimeType: "",
                        fOrderPolicy: "",
                        fPlanBatchSplitQty: "",
                        fPlanBatchSplitQtyUnit: "",
                        fPlanGroupId: "",
                        fPlanIdent: "",
                        fPlanIntervalsDays: 0,
                        fPlanOffsetTime: 0,
                        fPlanOffsetTimeType: "",
                        fPlanSafeStockQty: 0,
                        fPlanSafeStockQtyUnit: "",
                        fPlanTimeZone: 0,
                        fPlanWorkshop: "",
                        fPlanerId: "",
                        fPlanningStrategy: "",
                        fProScheTrackId: "",
                        fProductLine: "",
                        fRequestTimeZone: 0,
                        fSupplySourceId: "",
                        fVarLeadTime: 0,
                        fVarLeadTimeLotSize: "",
                        fVarLeadTimeLotSizeUnit: "",
                        fVarLeadTimeType: "",
                        fWriteOffQty: "",
                        fWriteOffQtyUnit: "",
                        id: "",
                        materialId: "",
                        maxPoqtyUnit: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        remark: "",
                        searchValue: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      materialProcureEntity: {
                        agentProcure: "",
                        barCodeRule: "",
                        createBy: "",
                        createTime: "",
                        dayProduction: 0,
                        dayProductionUnit: "",
                        defaultSupplier: "",
                        defunctProductionLine: "",
                        expenseItem: "",
                        id: "",
                        isControl: "",
                        isDayProduction: "",
                        isMaterialReturn: "",
                        isQuota: "",
                        isReq: "",
                        materialId: "",
                        minPackNum: "",
                        minSpiltNum: 0,
                        outsourcePricingUnit: "",
                        outsourceType: "",
                        outsourceUnit: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        procureGroup: "",
                        procureId: "",
                        procurePricingUnit: "",
                        procureType: "",
                        procureUnit: "",
                        quotaMode: "",
                        remark: "",
                        repeatPutNum: "",
                        searchValue: "",
                        takeOverDelay: 0,
                        takeOverDown: "",
                        takeOverLead: 0,
                        takeOverUp: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      materialProductEntity: {
                        createBy: "",
                        createTime: "",
                        deptId: "",
                        fBackFlushType: "",
                        fConsumVolatility: "",
                        fDefaultLineId: "",
                        fDefaultRouting: "",
                        fFinishReceiptOverRate: "",
                        fFinishReceiptShortRate: "",
                        fIsCompleteSet: "",
                        fIsEnableSchedule: "",
                        fIsKitting: "",
                        fIsMainPrd: "",
                        fIsMinissueQty: "",
                        fIsProductLine: "",
                        fIsSNCarryToParent: "",
                        fIssueType: "",
                        fMdlId: "",
                        fMdlMaterialId: "",
                        fMinissueQty: 0,
                        fMinissueUnitId: "",
                        fOrgTrustBillType: "",
                        fOverControlMode: "",
                        fPerUnitStandHour: "",
                        fPickBinId: "",
                        fPickStockId: "",
                        fProduceBillType: "",
                        fProduceUnitId: "",
                        fStandHourUnitId: "",
                        fStdLaborPrePareTime: "",
                        fStdLaborProcessTime: "",
                        fStdMachinePrepareTime: "",
                        fStdMachineProcessTime: "",
                        fWorkShopId: "",
                        fbkfltime: "",
                        fbomunitid: "",
                        ffixloss: "",
                        fisecn: "",
                        flosspercent: "",
                        id: "",
                        materialId: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        remark: "",
                        searchValue: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      materialProperty: "",
                      materialQualityEntity: {
                        createBy: "",
                        createTime: "",
                        fCheckDelivery: "",
                        fCheckEntrusted: "",
                        fCheckIncoming: "",
                        fCheckOther: "",
                        fCheckProduct: "",
                        fCheckReturn: "",
                        fCheckStock: "",
                        fCheckSubFtnMtrl: "",
                        fEWLeadDay: "",
                        fEnableCyclistQCSTK: "",
                        fEnableCyclistQcstkew: "",
                        fFirstQCControlType: "",
                        fIncQcSchemeId: "",
                        fIncSampSchemeId: "",
                        fInspectGroupId: "",
                        fInspectorId: "",
                        fIsFirstInspect: "",
                        fStockCycle: "",
                        id: "",
                        materialId: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        remark: "",
                        searchValue: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      materialSaleEntity: {
                        allowReleaseOrder: "",
                        allowReturns: "",
                        atpCheck: "",
                        controlSurpassUnit: "",
                        createBy: "",
                        createTime: "",
                        dropOutCount: "",
                        fisReturnPart: "",
                        fisaftersale: "",
                        fisproductfiles: "",
                        fiswarranted: "",
                        fwarranty: "",
                        fwarrantyunitid: "",
                        id: "",
                        isFavourableTax: "",
                        materialId: "",
                        pageNo: 0,
                        pageSize: 0,
                        params: {},
                        remark: "",
                        saleDownPrice: "",
                        saleGroup: "",
                        saleOutbound: "",
                        salePricingUnit: "",
                        saleUnit: "",
                        searchValue: "",
                        startOrderNum: 0,
                        surpassDown: "",
                        surpassUp: "",
                        taxType: "",
                        taxTypeCode: "",
                        updateBy: "",
                        updateTime: "",
                      },
                      mnemonicCode: "",
                      model: "",
                      modelId: "",
                      netWeight: "",
                      oldMaterialCode: "",
                      pageNo: 0,
                      pageSize: 0,
                      params: {},
                      reasonForDisable: "",
                      remark: "",
                      searchValue: "",
                      sizeUnit: "",
                      state: "",
                      subItems: "",
                      taxType: "",
                      typeName: "",
                      unit: "",
                      updateBy: "",
                      updateTime: "",
                      volume: "",
                      weightUnit: "",
                      wideStr: "",
                    },
                    materialChangeEntity: {},
                    materialCode: "",
                    materialId: "",
                    netAmount: "",
                    noTaxMoney: "",
                    number: 0,
                    orderDelivery: {
                      batchNum: "",
                      bomVer: "",
                      changeTime: "",
                      controlDeliveryNum: true,
                      controlDeliveryTime: true,
                      createTime: "",
                      deliveryDelayDay: "",
                      deliveryDown: "",
                      deliveryEarlyTime: "",
                      deliveryLatestTime: "",
                      deliveryLeadDay: "",
                      deliveryUp: "",
                      id: "",

                      materialId: "",
                      materialName: "",
                      orderDeliveryDetails: [
                        {
                          address: "",
                          changeTime: "",
                          confirmComment: "",
                          confirmNum: "",
                          confirmTime: "",
                          createTime: "",
                          deliveredNum: "",
                          deliveryTime: "",
                          id: "",

                          location: "",
                          num: "",
                          orderDeliveryId: "",
                          orderId: "",
                          planUnit: "",
                          surplusNum: "",
                          userId: "",
                        },
                      ],
                      orderId: "",
                      receiveDept: "",
                      receiveOrg: "",
                      requireDept: "",
                      requireOrg: "",
                      supplierBatch: "",
                      supportAttr: "",
                      userId: "",
                    },
                    orderFinanceDetail: {
                      changeTime: "",
                      createTime: "",
                      discountAmount: "",
                      discountRate: "",
                      entryPriceInfo: "",
                      id: "",

                      materialCode: "",
                      materialId: "",
                      materialName: "",
                      netPrice: "",
                      orderId: "",
                      priceCeiling: "",
                      priceCoefficient: "",
                      priceFloor: "",
                      pricingNum: "",
                      pricingUnit: "",
                      settlementDept: "",
                      systemPricing: "",
                      taxRate: "",
                      unitPriceDiscount: "",
                      userId: "",
                    },
                    orderOther: {
                      businessClose: "",
                      businessFreeze: "",
                      businessProcess: "",
                      businessStop: "",
                      changeTime: "",
                      contractsCode: "",
                      createTime: "",
                      freezeName: "",
                      freezeTime: "",
                      id: "",
                      inventoryReturnNum: "",
                      isPlanConfirm: "",
                      isQuotaGeneration: "",

                      materialCode: "",
                      materialId: "",
                      materialName: "",
                      materialReceivedReturnNum: "",
                      orderId: "",
                      planTrackingCode: "",
                      requireDocCode: "",
                      requireDocLineCode: "",
                      requireFrom: "",
                      requireTrackingCode: "",
                      sourceDocCode: "",
                      sourceDocType: "",
                      stopName: "",
                      stopTime: "",
                      surplusInboundNum: "",
                      surplusMaterialReceivedNum: "",
                      totalInboundNum: "",
                      totalMaterialReceivedNum: "",
                      totalMaterialReturnNum: "",
                      updateFlag: "",
                      userId: "",
                    },
                    originalContainsTaxPrice: "",
                    originalNumber: "",
                    page: 0,
                    parentMaterial: "",
                    price: "",
                    pricingNum: "",
                    pricingUnit: "",
                    purchaseUnit: "",
                    ramarks: "",
                    receivedFirstTicketsNum: "",
                    receivingDept: "",
                    relationId: "",
                    requireDept: "",
                    saleOrderDelivery: {
                      createBy: "",
                      createTime: "",
                      deliveryDown: "",
                      deliveryType: "",
                      deliveryUnit: "",
                      deliveryUp: "",
                      id: "",
                      inventoryDept: "",

                      materialCode: "",
                      materialName: "",
                      orderId: "",
                      pageNo: 0,
                      pageSize: 0,
                      params: {},
                      remark: "",
                      saleOrderDeliveryDetailEntities: [
                        {
                          createBy: "",
                          createTime: "",
                          deliveryAddress: "",
                          deliveryAddressDetail: "",
                          deliveryDate: "",
                          deliveryId: "",
                          id: "",
                          inAdvance: "",

                          pageNo: 0,
                          pageSize: 0,
                          params: {},
                          planDeliveryDate: "",
                          remark: "",
                          saleNum: "",
                          saleUnit: "",
                          searchValue: "",
                          updateBy: "",
                          updateTime: "",
                        },
                      ],
                      searchValue: "",
                      updateBy: "",
                      updateTime: "",
                    },
                    settlementDept: "",
                    sourceDocCode: "",
                    sourceDocType: "",
                    sourceRelationId: "",
                    supplierMaterialCode: "",
                    supplierMaterialName: "",
                    taxAmount: "",
                    taxMoney: "",
                    taxPrice: "",
                    taxRate: "",
                    token: "",
                    totalAcceptanceAmount: "",
                    totalAcceptanceRate: "",
                    totalTaxPrice: "",
                    type: 0,
                    warehouseId: "",
                    warehouseRegionId: "",
                  },
                ],
                modelId: "",
                originalOrderCode: "",
                pageNo: 0,
                pageSize: 0,
                params: {},
                parentId: "",
                payer: "",
                paymentTerms: "",
                priceTax: "",
                priceinfoId: "",
                rate: "",
                rateType: "",
                receivingParty: "",
                remark: "",
                saleCode: "",
                saleDate: "",
                saleDept: "",
                saleGroup: "",
                saleId: "",
                searchValue: "",
                settlementParty: "",
                settlementType: "",
                shippingAddress: "",
                shippingPerson: "",
                shippingPersonName: "",
                shippingPhone: "",
                sourceDocType: "",
                sourceDocTypeName: "",
                state: "",
                taxAmount: "",
                updateBy: "",
                updateState: "",
                updateTime: "",
                valueTax: "",
              };
            },
            storage: () => {
              obj = {
                batchNumber: "",
                changeTime: "",
                contractId: "",
                createTime: "",
                id: "",
                inOutTime: "",
                inStorageType: 0,
                instanceId: 0,

                limit: 0,
                orderId: "",
                page: 0,
                projectId: "",
                purchaseCode: "",
                remarks: "",
                state: 0,
                supplierId: "",
                token: "",
                type: 0,
                useUserId: "",
                warehouseId: "",
                warehouseRegionId: "",
              };
            },
          };
          nameMap[type] ? nameMap[type]() : "";
          arr.push(obj);
        });
      }
    },
    // 单据类型 级联选择器
    handleInvoiceChange(val) {
      if (val[val.length - 1] === "YFD01_SYS") {
        // 标准应付单
        this.docTypeStandard = val;
        this.docTypeExpanse = [];
      } else if (val[val.length - 1] === "YFD02_SYS") {
        // 费用应付单
        this.docTypeExpanse = val;
        this.docTypeStandard = [];
      } else {
        this.docTypeStandard = [];
        this.docTypeExpanse = [];
      }
    },
    // 基础表单提交
    submit(cb) {
      this.$refs["formRef"].validate((valid) => {
        if (!valid) return;
        // TODO 提交表单
        if (this.formData.docType) {
          this.formObject.kingInvoicePayableEntity.docTypeCode =
            this.formObject.docTypeCode[this.formObject.docTypeCode.length - 1];
        }
        addInfo(this.formData).then((res) => {
          if (res.code === 200) {
            cb();
            this.$message({
              message: "新增成功！",
              type: "success",
            });
          }
        });
      });
    },
  },
  created() {
    let that = this;
    this.props = {
      lazy: true,
      lazyLoad(node, resolve) {
        const { level } = node;
        const parentCode = level >= 1 ? node.value : "All";
        getDocTypeList({ parentCode }).then((res) => {
          if (res.code === 200) {
            this.documentTypeList = res.rows;
            const nodes = res.rows.map((item) => ({
              value: item.docCode,
              label: item.title,
            }));
            // 通过调用resolve将子节点数据返回，通知组件数据加载完成
            resolve(nodes);
          }
        });
      },
    };
  },
};
</script>
<style lang="scss" scoped></style>
